Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

c# - Anonymous editable link doesn't allow edit an excel file

I want to create an editable anonymous link for an Excel file from SharePoint document library. As per the documentation Microsoft Graph C# SDK, I should be able to use createLink API with this code.

var driveItem = await graphClient.Drive
                    .Items[itemId]
                    .CreateLink("edit", "anonymous", null, null, null)
                    .Request()
                    .PostAsync();

return driveItem.Link.WebUrl;

But with the created link I can only view the excel file. The link does not allow editing the excel file. How can I create the link for the excel file?

Also, the same code working with MS Word files.

I am using Share Point Document Library and calling the APIs via Microsoft graph explorer.

question from:https://stackoverflow.com/questions/65949767/anonymous-editable-link-doesnt-allow-edit-an-excel-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you have that excel document in sharepoint document library you should give the siteid,driveid and then itemid in you code, something like this.

graphClient.Sites["siteid"]
    .Drives["documentlibraryid"]
    .Items["itemId"]                     
    .CreateLink("edit", "anonymous", null, null, null)
    .Request()                     
    .PostAsync();

This way I was able to edit the excel file without logging as anonymous. I had also tested it in POSTMAN which also worked perfectly.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...