Exemple #1
0
        /// <summary>
        /// This method creates a sharing link for a target DriveItem
        /// </summary>
        /// <param name="driveItemId">The ID of the DriveItem</param>
        /// <param name="type">The type of the sharing link</param>
        /// <param name="scope">The scope of the sharing link</param>
        /// <returns>The just added permission for the sharing link</returns>
        public static Permission CreateSharingLink(String driveItemId, SharingLinkType type, SharingLinkScope scope)
        {
            var jsonResponse = MicrosoftGraphHelper.MakePostRequestForString(
                String.Format("{0}me/drive/items/{1}/microsoft.graph.createLink",
                              MicrosoftGraphHelper.MicrosoftGraphV1BaseUri,
                              driveItemId),
                new {
                @type  = type.ToString().ToLower(),
                @scope = scope.ToString().ToLower(),
            },
                "application/json"
                );

            var addedPermission = JsonConvert.DeserializeObject <Permission>(jsonResponse);

            return(addedPermission);
        }
Exemple #2
0
        /// <summary>
        /// This method creates a sharing link for a target DriveItem
        /// </summary>
        /// <param name="driveItemId">The ID of the DriveItem</param>
        /// <param name="type">The type of the sharing link</param>
        /// <param name="scope">The scope of the sharing link</param>
        /// <returns>The just added permission for the sharing link</returns>
        public static Permission CreateSharingLink(String driveItemId, SharingLinkType type, SharingLinkScope scope)
        {
            var jsonResponse = MicrosoftGraphHelper.MakePostRequestForString(
                String.Format("{0}me/drive/items/{1}/createLink",
                    MicrosoftGraphHelper.MicrosoftGraphV1BaseUri,
                    driveItemId),
                    new {
                        @type = type.ToString().ToLower(),
                        @scope = scope.ToString().ToLower(), 
                    },
                    "application/json"
                );

            var addedPermission = JsonConvert.DeserializeObject<Permission>(jsonResponse);
            return (addedPermission);
        }