2016-04-25 1 views
0

Actuellement coincé avec l'obtention du nom de fichier d'une ressource à partir de SharePoint en ligne, à savoir Office 365. Le jeton d'authentification et d'actualisation provient de l'exemple Unified Api alias Microsoft Graph.Microsoft Graph nom de fichier

var authResult = await authContext.AcquireTokenByAuthorizationCodeAsync( 
... 
var imgBytes = await httpClient.GetByteArrayAsync(parameters.FileGet); 
return File(imgBytes, "application/specialFormat", "File1.specialFormat"); 

Pour le moment, je dois définir mon propre nom de fichier. J'ai déjà vu l'exemple à http://graph.microsoft.io/en-us/docs/overview/overview, mais l'exemple « GET mes fichiers » montre seulement comment obtenir les fichiers d'une personne, et non comment obtenir un nom de fichier basé sur un identifiant de fichier. J'espère que quelqu'un pourrait clarifier cela.

https://graph.microsoft.com/v1.0/me/drive/root/children 

est d'obtenir un nom de fichier basé sur l'ID de fichier avec le api graphique possible ou dois-je utiliser autre chose?

EDIT Certaines requêtes qui travailleraient:

https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id 
https://graph.microsoft.com/v1.0/me/drive/root/children?$filter=name eq 'testfile.office' 

Mais si je tente de rechercher l'identifiant spécifique la requête échoue et je reçois aucune des informations.

https://graph.microsoft.com/v1.0/me/drive/root/children?$filter=id eq '01QXOQU7OCV7FW2BQNAZD3KNZMYXVMNJD6' 

Répondre

2

Si vous avez l'ID d'article, vous pouvez accéder à l'élément comme celui-ci: https://graph.microsoft.com/v1.0/me/drive/items/ID

Si vous avez le chemin, vous pouvez accéder à l'élément comme celui-ci: https://graph.microsoft.com/v1.0/me/drive/root:/FOLDER/FOLDER/FOLDER/FILENAME.EXT

Vous pouvez plus obtenir les enfants d'un élément par chemin: https://graph.microsoft.com/v1.0/me/drive/root:/FOLDER/FOLDER/FOLDER/FILENAME.EXT:/children

L'API Drive exposé via MS Graph est à peu près (sinon exactement) le Identique à l'API exposée par OneDrive. Voir cette page de référence: https://dev.onedrive.com/resources/item.htm