質問

I am looking for a way to update the one drive file or document using some SharePoint CSOM code. So can we achieve this using CSOM or some C# code?

I have even tried to load one drive site collection URL using the below code but I am not able to find the actual list from where I can access the stored files from one drive.

One Drive Site URL : https://{tenant}.my.sharepoint.com/personal/pravin_{tenant}_com

using (ClientContext clientcontext = new ClientContext(ConfigurationManager.AppSettings["SiteUrl"]))
{
                Web web = clientcontext.Web;
                clientcontext.Load(clientcontext.Web.Lists);
                clientcontext.ExecuteQuery();

                foreach (List list in clientcontext.Web.Lists)
                {
                       var items = list.GetItems(CamlQuery.CreateAllItemsQuery());
                       clientcontext.Load(items);
                       clientcontext.ExecuteQuery();

                       foreach (var docItem in items)
                       {
                          //Here, I want to update the one drive file and upload it again using some sort of code.
                       }
                }
}

Please suggest the code or other ways using which we can update the one drive files programmatically.

Please help. Thanks in Advance.

役に立ちましたか?

解決

The file is stored in the List Documents.

List list = clientcontext.Web.Lists.GetByTitle("Documents");
clientcontext.Load(list);
clientcontext.ExecuteQuery();
list.GetItems(CamlQuery.CreateAllItemsQuery());
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top