OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
294 stars 143 forks source link

(Temporarely) share a file #171

Closed mythjuha closed 8 years ago

mythjuha commented 8 years ago

I'm trying to find a way to create a download link to a file through the C# sdk. Ideally, the link should only be accessible for a short period of time (1 minute or so). The AdditionalData @content.downloadUrl property seems ideal, however the filename and extension is completely lost this way.

Alternatively i looked at how to create a more 'permanent' share link (https://dev.onedrive.com/items/sharing_createLink.htm), but did not find how to do this with the C# sdk. Is this fuctionallity still missing?

cdmayer commented 8 years ago
// Create the link
var permission = await item.CreateLink("view")
    .Request()
    .PostAsync();

// you can send permission.Link to someone else here

// Delete the link
await item.Permissions[permission.Id]
    .Request()
    .DeleteAsync();