Box.V2.Managers.BoxFoldersManager.CreateSharedLinkAsync C# (CSharp) Method

CreateSharedLinkAsync() public method

Used to create a shared link for this particular folder. In order to get default shared link status, set it to an empty access level. To delete a shared link use the DeleteSharedLinkAsync method of this class.
public CreateSharedLinkAsync ( string id, Box.V2.Models.BoxSharedLinkRequest sharedLinkRequest, List fields = null ) : Task
id string Id of the folder to create shared link for
sharedLinkRequest Box.V2.Models.BoxSharedLinkRequest Shared link request object
fields List Attribute(s) to include in the response
return Task
        public async Task<BoxFolder> CreateSharedLinkAsync(string id, BoxSharedLinkRequest sharedLinkRequest, List<string> fields = null)
        {
            id.ThrowIfNullOrWhiteSpace("id");

            BoxRequest request = new BoxRequest(_config.FoldersEndpointUri, id)
                .Method(RequestMethod.Put)
                .Param(ParamFields, fields)
                .Payload(_converter.Serialize(new BoxItemRequest() { SharedLink = sharedLinkRequest }));

            IBoxResponse<BoxFolder> response = await ToResponseAsync<BoxFolder>(request).ConfigureAwait(false);

            return response.ResponseObject;
        }