none
[UWP] Looking for a way for get Photos from Shared OneDrive Folder

    Pertanyaan

  • Hi,

    i developed an app that scans me local folders for images, that i can list filtered by tags, marks, rating stars, name and so on, and then changes me Desktop Background in a given interval using a Background task,

    Now i'm searching an idea/way for get a list of photos from a OneDrive Shared Photo Album, or photos in a private shared folder.

    Background is that i wan't build an app for an IoT Raspberry i wan't to placed in home of my parents for show photos i placed in a shared folder

    I found how i can access/get my own onedrive photos/files, but how can i access to a shared folder/album?

    Thanks

    Kamis, 30 Agustus 2018 08.24

Semua Balasan

  • You'll want to look in the OneDrive dev center at https://developer.microsoft.com/en-us/onedrive for info on OneDrive. If you can't find what you need in the docs or samples then the support menu at the top of the page links to the Stackoverflow tags and GitHub repositories that the OneDrive SDK specialists will be looking at.

    From a quick skim of that site the "List items shared with the signed-in user" page looks promising for your scenario: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_sharedwithme 

    Kamis, 30 Agustus 2018 17.25
  • Hi Rob, Thanks for the Link.

    but i can't figure it out, i take a look at OneDrivePhoto Browser Sample and the MS Graph SDK

    Need i explicitly Authentication for the Sample? In link it says Permissions needed are Delegated (Work or private) or by Application

    My (UWP)  App is Published in MS Store, and i have the Client ID.Graph SDK Installed by Nuget ....

    Perhaps i'm thinking twice, and sorry the stupid question, but how can i figure out this samples   in C#? In the Samples above i can't find anys similar.

    Sorry. and Thanks.

    PS: i try now the MS Graph Explorer with follow url:

    https://graph.microsoft.com/v1.0/me/drive/shares/{what id?}/driveItem?$expand=children

    Must this work?Doesn't work for me

    I found some examples, but all this are different, and some looks too old, or doenst't work. I try too the sample generated by MS Graph QuickStart 

    but don't work, it says ClientApplicationBase.Users is obsolete, Use GetAccountsasync.. after change this, i can't login, it says me tecnical problems with your account, we couldn't connect to O365...   Is very frustrating  not found any working sample :(   .



    • Diedit oleh elTorito Selasa, 04 September 2018 12.57
    Selasa, 04 September 2018 08.15
  • Okay. Finally i did it?

    I follow this Tutorial : Build UWP Apps with the Micrososft Graph .NET SDK

    After i Make it work.... so as described, the sample only works with  Microsoft.Graph v1.9.0, Microsoft.Identity.Client v1.1.3-prview0012, and Microsoft.NETCore.UniversalWindowsPlatform i have 6.1.7, trying Updating Ms Graph or the MS Identity Client, give me a non workable project.


    With follow Code i can address the Files in a shared folder(after login with my own MS Account), and Download it by the Additional Data Url. :

    var requestSharedItems = graphService.Shares["{SharedId}"].DriveItem.Children.Request(); var userSharedDriveItemsCollectionPage = await requestSharedItems.GetAsync(); var listSharedODItems = new List<ODSharedItem>(); foreach (var item in userSharedDriveItemsCollectionPage) { System.Diagnostics.Debug.WriteLine("Shared Filename: " + item.Name);
    System.Diagnostics.Debug.WriteLine("Download Url" + item.AdditionalData.FirstOrDefault(x => x.Key == "@microsoft.graph.downloadUrl").Value);

    }


    i Obtain the ShareId when i show on onedrive on permissions , the link for the shared folder perhaps is: https://1drv.ms/u/s!AtXhck3rtjk36k7BKnX7fjqH9MoRw8A, the ShareId is: s!AtXhck3rtjk36k7BKnX7fjqH9MoRw8A

    In the Code above i put:

    graphService.Shares["s!AtXhck3rtjk36k7BKnX7fjqH9MoRw8A"].DriveItem.Children.Request();

    Perhaps this info helps someone, it looks like fewest persons will try over this Method. 

    There are a lot of confused stuff around this (MS GRaph SDK, Onedrive SDK, and so on, and a lot of stuff isn't up to date.. be it how it may, it runs now. :-)

    Thanks.


    Kamis, 06 September 2018 13.01