public override bool[] Share(IElementoNube elemento, bool notify = true, string message = null, SharingLevel level = SharingLevel.ViewerNoComment, params string[] emailsUsersToShare) { bool[] shared = new bool[emailsUsersToShare.Length]; List <FileMemberActionResult> results; Dropbox.Api.Sharing.AddMember[] membersFolder; Dropbox.Api.Sharing.MemberSelector[] membersFile; Dropbox.Api.Sharing.AccessLevel shareLevel = GetShareLevel(level); if (elemento.IsAFolder) { membersFolder = new Dropbox.Api.Sharing.AddMember[emailsUsersToShare.Length]; for (int i = 0; i < membersFolder.Length; i++) { membersFolder[i] = new Dropbox.Api.Sharing.AddMember(new Dropbox.Api.Sharing.MemberSelector.Email(emailsUsersToShare[i]), shareLevel); } client.Sharing.AddFolderMemberAsync(GetIdShareFolder(elemento), membersFolder, notify, message).Wait(); } else { membersFile = new MemberSelector[emailsUsersToShare.Length]; for (int i = 0; i < membersFile.Length; i++) { membersFile[i] = new MemberSelector.Email(emailsUsersToShare[i]); } results = client.Sharing.AddFileMemberAsync(elemento.PathNube, membersFile, message, notify, shareLevel).Result; for (int i = 0; i < results.Count; i++) { shared[i] = results[i].Result.IsSuccess; } } return(shared); }
/// <summary> /// <para>Initializes a new instance of the <see cref="UpdateFileMemberArgs" /> /// class.</para> /// </summary> /// <param name="file">File for which we are changing a member's access.</param> /// <param name="member">The member whose access we are changing.</param> /// <param name="accessLevel">The new access level for the member.</param> public UpdateFileMemberArgs(string file, MemberSelector member, AccessLevel accessLevel) : base(file, member, accessLevel) { }
/// <summary> /// <para>Initializes a new instance of the <see cref="SharedFileMetadata" /> /// class.</para> /// </summary> /// <param name="id">The ID of the file.</param> /// <param name="name">The name of this file.</param> /// <param name="policy">Policies governing this shared file.</param> /// <param name="previewUrl">URL for displaying a web preview of the shared /// file.</param> /// <param name="accessType">The current user's access level for this shared /// file.</param> /// <param name="expectedLinkMetadata">The expected metadata of the link associated for /// the file when it is first shared. Absent if the link already exists. This is for an /// unreleased feature so it may not be returned yet.</param> /// <param name="linkMetadata">The metadata of the link associated for the file. This /// is for an unreleased feature so it may not be returned yet.</param> /// <param name="ownerTeam">The team that owns the file. This field is not present if /// the file is not owned by a team.</param> /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field /// is present only if the file is contained within a shared folder.</param> /// <param name="pathDisplay">The cased path to be used for display purposes only. In /// rare instances the casing will not correctly match the user's filesystem, but this /// behavior will match the path provided in the Core API v1. Absent for unmounted /// files.</param> /// <param name="pathLower">The lower-case full path of this file. Absent for unmounted /// files.</param> /// <param name="permissions">The sharing permissions that requesting user has on this /// file. This corresponds to the entries given in <see /// cref="Dropbox.Api.Sharing.GetFileMetadataBatchArg.Actions" /> or <see /// cref="Dropbox.Api.Sharing.GetFileMetadataArg.Actions" />.</param> /// <param name="timeInvited">Timestamp indicating when the current user was invited to /// this shared file. If the user was not invited to the shared file, the timestamp /// will indicate when the user was invited to the parent shared folder. This value may /// be absent.</param> public SharedFileMetadata(string id, string name, FolderPolicy policy, string previewUrl, AccessLevel accessType = null, ExpectedSharedContentLinkMetadata expectedLinkMetadata = null, SharedContentLinkMetadata linkMetadata = null, global::Dropbox.Api.Users.Team ownerTeam = null, string parentSharedFolderId = null, string pathDisplay = null, string pathLower = null, col.IEnumerable <FilePermission> permissions = null, sys.DateTime?timeInvited = null) { if (id == null) { throw new sys.ArgumentNullException("id"); } if (id.Length < 1) { throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1"); } if (!re.Regex.IsMatch(id, @"\A(?:id:.*)\z")) { throw new sys.ArgumentOutOfRangeException("id", @"Value should match pattern '\A(?:id:.*)\z'"); } if (name == null) { throw new sys.ArgumentNullException("name"); } if (policy == null) { throw new sys.ArgumentNullException("policy"); } if (previewUrl == null) { throw new sys.ArgumentNullException("previewUrl"); } if (parentSharedFolderId != null) { if (!re.Regex.IsMatch(parentSharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z")) { throw new sys.ArgumentOutOfRangeException("parentSharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'"); } } var permissionsList = enc.Util.ToList(permissions); this.Id = id; this.Name = name; this.Policy = policy; this.PreviewUrl = previewUrl; this.AccessType = accessType; this.ExpectedLinkMetadata = expectedLinkMetadata; this.LinkMetadata = linkMetadata; this.OwnerTeam = ownerTeam; this.ParentSharedFolderId = parentSharedFolderId; this.PathDisplay = pathDisplay; this.PathLower = pathLower; this.Permissions = permissionsList; this.TimeInvited = timeInvited; }