none
How to add Microsoft.SharePoint.Client.Runtime reference to project RRS feed

  • Question

  • Hi,

    I'm creating an application to get all list items from SharePoint 2010 site using Client object model, and trying to add the following

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Client;

    using Microsoft.SharePoint.Client.Runtime

    I copied the dlls from "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI" folder and pasted in the project's bin folder and add reference to it.

    I can see all 3 dll's under project's reference folder in solution explorer. But the the line "using Microsoft.SharePoint.Client.Runtime" is throwing error, saying: The type or namespace 'Runtime' does not exist in the namespace 'Microsoft.SharePoint.Client' (are you missing an assembly reference?)

    How can I solve this issue, Please help me

    Thank you

    Monday, August 3, 2015 7:10 AM

Answers

  • Hi Alexx,

    In the “Microsoft.SharePoint.Client.dll” and “Microsoft.SharePoint.Client.Runtime.dll”, there is no such a namespace “Microsoft.SharePoint.Client.Runtime”, that’s why it is not allowed to be added in your code:

    Thanks 


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Friday, August 14, 2015 9:07 AM
    Moderator

All replies

  • As shown in the below snapshot, the SharePoint 2013 Client DLL's reside in the 15 hive of client machines. Also, there is a statement ,using Microsoft.SharePoint; which is a server side assembly reference and needs to be removed.

    In case of a client machine missing these references, you can place the Client DLL's in a folder under the solution, go to the properties of each dll and specify Build Action as Content and Copy to Output Directory as Copy Always.  This helps to retain the reference as part of the solution rather than pointing to a location on the client machine.


    Monday, August 3, 2015 9:30 AM
  • Hi,

    Thank you for the reply,

    I did what you have explained, and I can see "Microsoft.SharePoint.Client" and "Microsoft.SharePoint.Client.Runtime" dlls under Solution Explorer's References, but when adding the line

    using Microsoft.SharePoint.Client.Runtime, am getting the same error:  The type or namespace 'Runtime' does not exist in the namespace 'Microsoft.SharePoint.Client' (are you missing an assembly reference?)

    Any idea, how can I reference the dll?

    Thank you.

    Monday, August 3, 2015 10:54 AM
  • Hi,

    According to your description, the two dlls have been added correctly, now what you might want to using the “Microsoft.SharePoint.Client.Runtime” in the code file.

    As the error suggests, “the namespace 'Runtime' does not exist in the namespace 'Microsoft.SharePoint.Client'”, in the “Microsoft.SharePoint.Client.Runtime” dll, there is also no such a namespace exists. Thus, you can remove the line of code “using Microsoft.SharePoint.Client.Runtime”.

    Thanks

    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, August 4, 2015 4:34 AM
    Moderator
  • You only need:

    using Microsoft.SharePoint.Client;

    using Microsoft.SharePoint.Client.Runtime;

    for client object model.


    Regards,
    Rupesh Singh
    -------------------------------------------------------------
    Please don't forget to mark it as answered, if your problem resolved or helpful.

    Tuesday, August 4, 2015 4:50 AM
  • Hi Patrick,

    Yes you are right, I can access the site and do all site and list related activities by adding only "Microsoft.SharePoint.Client" dll and namespace. But I'm curies to know, why it's throwing error when all process is correct.

    Any idea?

    Thank you.

    Tuesday, August 4, 2015 4:08 PM
  • Hi,

    So do you mean that, if you add the "using Microsoft.SharePoint.Client;" only, the error still occurs?

    If this is the case, then I would suggest you create new project for another test.

    Moreover, in Visual Studio, you can type all the code needed directly without writing the “using” statements by yourself, then the IDE will show a warning message to help you “using” the correct namespaces.

    Thanks

    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, August 6, 2015 2:05 PM
    Moderator
  • Hi Alexx,

    In the “Microsoft.SharePoint.Client.dll” and “Microsoft.SharePoint.Client.Runtime.dll”, there is no such a namespace “Microsoft.SharePoint.Client.Runtime”, that’s why it is not allowed to be added in your code:

    Thanks 


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Friday, August 14, 2015 9:07 AM
    Moderator