Monday, February 5, 2007

How to Reference the SharePoint Assemblies

(Thanks to .Net Geeks)

To develop against the SharePoint assembly on a machine that is not a server, check out the following:

Setting a Reference to the Microsoft.SharePoint Assembly

After creating a project, add a reference to the Microsoft.SharePoint assembly to import its namespaces and implement IntelliSense features in the Object Browser and Code Editor.
To add a reference to the Microsoft.SharePoint assembly

  1. In Solution Explorer, right-click the project, and then click Add Reference on the shortcut menu.
  2. On the .NET tab of the Add Reference dialog box, select Windows SharePoint Services in the list of components, and then click OK.
    To run or debug code that uses the Microsoft.SharePoint assembly, you must run the code on the server running Windows SharePoint Services. If you are using Visual Studio 2005 on a remote computer, you cannot run or debug code that uses the object model. However, you can set a remote reference to the assembly to write code and see the Microsoft.SharePoint assembly represented in the Code Editor. To add a remote reference in this way, do the following:
    Click the Browse tab and navigate to Microsoft.SharePoint.dll in Local_Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI folder on the server running Windows SharePoint Services. You may instead want to copy Microsoft.SharePoint.dll from this folder to a local drive on the remote computer, and then open this local copy of the DLL. Click Open.

(from http://msdn2.microsoft.com/en-us/library/ms479423.aspx)

No comments: