sharepoint-clientobject

Sharepoint 2010 client object model with camlQuery - file download but no content / 0 byte

こ雲淡風輕ζ 提交于 2019-12-01 04:58:56
问题 I'm trying to download a txt file from a subfolder within a folder in a document library. I'm using camlQuery to achieve this. Unfortunately, i get no content of the txt file. It has 0 byte. public void SaveFolderFiles(string fileName, string libraryName, ClientOM.ClientContext clientContext) { ClientOM.List sharedDocumentsList = clientContext.Web.Lists.GetByTitle(libraryName); ClientOM.CamlQuery camlQuery = new ClientOM.CamlQuery(); camlQuery.FolderServerRelativeUrl = "/Site/Folder

How to grant user permission to certain folders using Client Object Model?

折月煮酒 提交于 2019-12-01 01:09:55
So far I am able to grant user certain permission with the following code: ClientContext context = new ClientContext("http://myRealURL"); Principal user = context.Web.EnsureUser(@"myLoginAccout"); RoleDefinition readDef = context.Web.RoleDefinitions.GetByName("Read"); RoleDefinitionBindingCollection roleDefCollection = new RoleDefinitionBindingCollection(context); roleDefCollection.Add(readDef); RoleAssignment newRoleAssignment = context.Web.RoleAssignments.Add(user, roleDefCollection); context.ExecuteQuery(); The code above works fine, now my task is to add the user permission only to certain

field or property \\“ListItemAllFields\\” does not exist exception

ε祈祈猫儿з 提交于 2019-11-29 12:37:08
Below code credit goes to Vadim Gremyachev. My goal is to grant user access permissions to certain SharePoint folders by using the CSOM . The goal I am trying to achieve is to access the library called JZhu , and inside JZhu library, I have two folders folder1 and folder2 . I am trying to grant Reader permission to folder1 . So far the code is not working because I get exception at line 6 saying: field or property \"ListItemAllFields\" does not exist ClientContext context = new ClientContext("http://myRealUrl"); Principal user = context.Web.EnsureUser(@"myLoginAccout"); var folder = context

field or property \“ListItemAllFields\” does not exist exception

牧云@^-^@ 提交于 2019-11-28 06:16:26
问题 Below code credit goes to Vadim Gremyachev. My goal is to grant user access permissions to certain SharePoint folders by using the CSOM . The goal I am trying to achieve is to access the library called JZhu , and inside JZhu library, I have two folders folder1 and folder2 . I am trying to grant Reader permission to folder1 . So far the code is not working because I get exception at line 6 saying: field or property \"ListItemAllFields\" does not exist ClientContext context = new ClientContext(

How to use credentials to connect to a SharePoint list using the Client Side Object Model?

一笑奈何 提交于 2019-11-28 04:44:24
I need to write an application to update a list on a SharePoint 2010 site. I found the "SPSite" which I can create with the URL, but I can't figure out how to specify with which user I want to connect. The user isn't the current windows user, and the program isn't executed on the server. I saw the possibility to give a "SPUserToken", but in my method I only have the user, the domain, and his password, so how can I generate this user(and I think that this user is unknown on the system executing the code, but known on the server). Where can I specify that? Since you're using the client object

How to use credentials to connect to a SharePoint list using the Client Side Object Model?

南笙酒味 提交于 2019-11-27 00:37:20
问题 I need to write an application to update a list on a SharePoint 2010 site. I found the "SPSite" which I can create with the URL, but I can't figure out how to specify with which user I want to connect. The user isn't the current windows user, and the program isn't executed on the server. I saw the possibility to give a "SPUserToken", but in my method I only have the user, the domain, and his password, so how can I generate this user(and I think that this user is unknown on the system