Friday, January 08, 2010

Notes on Sharepoint development

This entry will be sort of unorganised, as I am slowly crawling to the jungle of options and bad documentation for Sharepoint. I will structure it as a list of points that I pass through and the solution for each problem. Hopefully, you will find something useful in it.

First of all, you cannot run Sharepoint on XP. Don't event try it. You need at least a Windows 2003 machine with the free Windows Sharepoint Services (acronym WSS) or with the commercial Microsoft Office Sharepoint Server (acronym MOSS) installed. In order to access the site, you will have to access the http://SharepointComputer URL.

Section: publishing a web part to the Sharepoint site running on WSS.
  • A web part project is a class library with associated libraries for it. First step is publication, which means copying the library files into the sharepoint site bin folder.
    Solution:
    1. find the physical location for the Sharepoint site onto the Sharepoint computer(usually wwwroot\wss\VirtualDirectories\80)
    2. copy the library files in the bin subfolder
  • Second step is loading the web parts into the Sharepoint gallery.
    Solution:
    1. open the http://SharepointComputer url
    2. open the Site Actions top-right menu and go to Site Settings
    3. open the Galleries - Web Parts link
    4. select the New option from the top toolbar
    5. the webparts in the library should appear in the list. check the checkbox next to them
    6. click Populate Gallery. now the web parts should be available in any page
  • Last step is adding the web parts to a page.
    Solution:
    1. go to any page that you can edit
    2. go to Site Actions and select Edit Page
    3. click the appropriate Add a Web Part header
    4. check the checkbox next to the web parts you want added, then click OK


Section: Troubleshooting the published web parts
  • If you have an error, you probably have a generic error page that says nothing of relevance.
    Solution:
    1. go to the physical location of the Sharepoint site
    2. edit the web.config file and set customErrors to mode="Off"
    3. refresh the Sharepoint site page in the browser
  • Now the error is much clearer and you see permissions errors that show Access Denied.
    Solution:
    1. go to the physical location of the Sharepoint site
    2. edit the Properties of the library files that you copied in the bin folder and set access for the asp.net user or (if you are lazy) for Everyone to read the site
  • Now the error you see other permissions errors of which you understand nothing, mostly linked to OnPrerender or Render methods.
    Solution:
    1. go to the physical location of the Sharepoint site
    2. edit the web.config file and (if you are lazy) set trust to level="Full" (capital F) or try to create your own security policy (complicated)
    3. refresh the Sharepoint site page in the browser
  • Oh, joy, the ugly error page with lots of information has vanished, leaving instead a nice error page saying nothing useful except File Not Found.
    Solution:
    1. go to the physical location of the Sharepoint site
    2. edit the web.config file and set compilation to debug="true" and SafeMode to CallStack="true"
    3. refresh the Sharepoint site page in the browser
  • Weird and unexplained errors occur.Solution:
    1. on the Sharepoint computer go to Administrative Tools and select Sharepoint 3.0 Central Administration
    2. that should open a site that is used to configure the Sharepoint site
    3. alternatively you can try the same Sharepoint URL in the browser, but using the port that was assigned to the configuration site (you can get the port from the name of the folder in wwwroot: wwwroot\wss\VirtualDirectories\[port that is not 80]
    4. go to the Operations section and select Diagnostic Logging
    5. In the Trace Log section you should see a Path, copy it to the clipboard
    6. Open the said path in Start/Run and it should open the Logs folder
    7. Open the latest log file (might need to press Ctrl-R to refresh the folder or to close the log file if already open and reopen it) and look for any cause for the errors


To be continued...

0 comments: