Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Invalid usage of query execution error

$
0
0

Hi,

I have got the following code in a script task in SSIS package, using SharePoint 2013 client object model.

//create context
Web web = clientspContext.Web;
clientspContext.Load(web);
Microsoft.SharePoint.Client.List list = GetListByTitleCS(clientspContext, "TestDoclib");
clientspContext.Load(list);      
clientspContext.ExecuteQuery();

When I run the above code in Visual Studio 2012 in my local machine in a script task in SSIS package it works fine. However, if I deploy the same package on a database server then getting the following error. Added all the SharePoint client dlls in the references in VS project. 

Script Task:Error: Invalid usage of query execution. The query should be executed by using the ExecuteQuery method.on the client context object at Microsoft.SharePoint.Client.ClientQueryProvider.Execute.

Any pointers or help would be appreciated.

Thanks,

Prav




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>