开发者

Namespace 'SharePoint' does not exist in the namespace 'Microsoft'

开发者 https://www.devze.com 2023-03-26 04:56 出处:网络
So I am starting to learn C#, like literally just started learning, and coming from a Java background, it doesn\'t look too bad. However, I have a question. I am following THIS tutorial on using the c

So I am starting to learn C#, like literally just started learning, and coming from a Java background, it doesn't look too bad. However, I have a question. I am following THIS tutorial on using the client-object model. And just starting from the top, I added the references, but using Microsoft.SharePoint.Client; keeps giving me the error that "the namespace 'SharePoint' does not exist in the namespace 'Micro开发者_如何学编程soft', but I clearly see it on the right side panel. So looking at the instructions, the only difference I can think of is that fact that I am using Visual Studio Express and thus do not have the option to choose which framework to use when creating a new project. Other than that, I don't know what the problem might be. Does anyone have any ideas on what else I could be missing or how to correct this problem?


Make sure that the target framework is 3.5 and not 4 i.e for SP2010


Did you add the references to the Microsoft.SharePoint.Client assembly and Microsoft.SharePoint.Client.Runtime assembly as noted near the beginning of that tutorial?


  1. Add required references to the solution.
  2. Make sure that the target framework is 4 for SP2013(3.5 for SP2010).


Did you do this part of the tutorial you mentioned above?

To build the application, you must add references to two assemblies, Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll. Installing SharePoint Foundation installs these assemblies on the server. The two assemblies are located in the following directory:

%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\ISAPI


Take a look at the references in your project and make sure you have the reference to the assembly. If it is not there try adding it, right click -->add reference and find "Microsoft.SharePoint.Client"


Thanks to those who mentioned the 4.0 framework.

Mine defaulted to .NET Framework 4 Client Profile (and I have no idea what that means), and the Namespaces looked good in Intellisense, but the build would say they weren't found! Crazy.


for anyone developing for SP2019, you need to target .net 4.5

0

精彩评论

暂无评论...
验证码 换一张
取 消