OneAdamTwelve
OneAdamTwelve

Reputation: 246

Can't use any "SP*" functions even though Sharepoint reference is there

I really hope this is an easy fix but I couldn't find this particular answer anywhere on the forum.

I would really like to use the SharePoint functions I keep seeing on the internet but for some reason I can't get them to work in Visual Studio.

For example:

SPUtility 

or

SPDateFormat.DateTime 

I have the following:

using Microsoft.SharePoint.Client;

and I also have all the SharePoint references that I could find installed for this program. What am I missing?

I know SOME things work like:

SharePointOnlineCredentials
CamlQuery
List

But when I start typing "SP" I am not getting the Visual Studio pop up to let me know code exists that starts with "SP".

screenshot of all my SharePoint References

screenshot of all my SharePoint References

Upvotes: 0

Views: 105

Answers (1)

Servy
Servy

Reputation: 203820

Those classes are all server object model classes. You'll need to use the client object model equivalents, like Microsoft.Sharepoint.Client.Utilities.Utility instead.

And not all of the functionality of the server object model exists in the client object model, so in some cases you'll need to find different solutions to your problem, go without, or find a way to run code on the server, depending on what, specifically you need to do.

Upvotes: 1

Related Questions