Example #1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadataBase" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        public SharedFolderMetadataBase(AccessLevel accessType,
                                        bool isTeamFolder,
                                        FolderPolicy policy,
                                        Dropbox.Api.Users.Team ownerTeam = null,
                                        string parentSharedFolderId      = null)
        {
            if (accessType == null)
            {
                throw new sys.ArgumentNullException("accessType");
            }

            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

            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'");
                }
            }

            this.AccessType           = accessType;
            this.IsTeamFolder         = isTeamFolder;
            this.Policy               = policy;
            this.OwnerTeam            = ownerTeam;
            this.ParentSharedFolderId = parentSharedFolderId;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFileMetadata" />
        /// class.</para>
        /// </summary>
        /// <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="name">The name of this file.</param>
        /// <param name="id">The ID of the file.</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="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="pathLower">The lower-case full path of this file. Absent for unmounted
        /// files.</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="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(FolderPolicy policy,
                                  string previewUrl,
                                  string name,
                                  string id,
                                  col.IEnumerable <FilePermission> permissions = null,
                                  Dropbox.Api.Users.Team ownerTeam             = null,
                                  string parentSharedFolderId = null,
                                  string pathLower            = null,
                                  string pathDisplay          = null,
                                  sys.DateTime?timeInvited    = null)
        {
            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

            if (previewUrl == null)
            {
                throw new sys.ArgumentNullException("previewUrl");
            }

            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            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'");
            }

            var permissionsList = enc.Util.ToList(permissions);

            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'");
                }
            }

            this.Policy               = policy;
            this.PreviewUrl           = previewUrl;
            this.Name                 = name;
            this.Id                   = id;
            this.Permissions          = permissionsList;
            this.OwnerTeam            = ownerTeam;
            this.ParentSharedFolderId = parentSharedFolderId;
            this.PathLower            = pathLower;
            this.PathDisplay          = pathDisplay;
            this.TimeInvited          = timeInvited;
        }
Example #3
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the FolderActions in the
        /// request.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isTeamFolder,
                                    FolderPolicy policy,
                                    string name,
                                    string sharedFolderId,
                                    col.IEnumerable <FolderPermission> permissions = null,
                                    Dropbox.Api.Users.Team ownerTeam = null,
                                    string parentSharedFolderId      = null,
                                    string pathLower = null)
            : base(accessType, isTeamFolder, policy, permissions, ownerTeam, parentSharedFolderId)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'");
            }

            this.Name           = name;
            this.SharedFolderId = sharedFolderId;
            this.PathLower      = pathLower;
        }
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="BasicSharedFolderMetadata" />
 /// class.</para>
 /// </summary>
 /// <param name="name">The name of the this shared folder.</param>
 /// <param name="id">The ID of the shared folder.</param>
 /// <param name="accessType">The current user's access level for this shared
 /// folder.</param>
 /// <param name="isTeamFolder">Whether this folder is a <a
 /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
 /// <param name="policy">Policies governing this shared folder.</param>
 /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
 /// unmounted folders.</param>
 public BasicSharedFolderMetadata(string name,
                                  string id,
                                  AccessLevel accessType,
                                  bool isTeamFolder,
                                  FolderPolicy policy,
                                  string pathLower = null)
     : base(name, id, accessType, isTeamFolder, policy, pathLower)
 {
 }
Example #5
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isInsideTeamFolder">Whether this folder is inside of a team
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="previewUrl">URL for displaying a web preview of the shared
        /// folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="timeInvited">Timestamp indicating when the current user was invited to
        /// this shared folder.</param>
        /// <param name="ownerDisplayNames">The display names of the users that own the folder.
        /// If the folder is part of a team folder, the display names of the team admins are
        /// also included. Absent if the owner display names cannot be fetched.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        /// <param name="parentFolderName">Display name for the parent folder.</param>
        /// <param name="linkMetadata">The metadata of the shared content link to this shared
        /// folder. Absent if there is no link on the folder. This is for an unreleased feature
        /// so it may not be returned yet.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the FolderActions in the
        /// request.</param>
        /// <param name="accessInheritance">Whether the folder inherits its members from its
        /// parent.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isInsideTeamFolder,
                                    bool isTeamFolder,
                                    string name,
                                    FolderPolicy policy,
                                    string previewUrl,
                                    string sharedFolderId,
                                    sys.DateTime timeInvited,
                                    col.IEnumerable <string> ownerDisplayNames = null,
                                    global::Dropbox.Api.Users.Team ownerTeam   = null,
                                    string parentSharedFolderId                    = null,
                                    string pathLower                               = null,
                                    string parentFolderName                        = null,
                                    SharedContentLinkMetadata linkMetadata         = null,
                                    col.IEnumerable <FolderPermission> permissions = null,
                                    AccessInheritance accessInheritance            = null)
            : base(accessType, isInsideTeamFolder, isTeamFolder, ownerDisplayNames, ownerTeam, parentSharedFolderId, pathLower, parentFolderName)
        {
            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 (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'");
            }

            var permissionsList = enc.Util.ToList(permissions);

            if (accessInheritance == null)
            {
                accessInheritance = global::Dropbox.Api.Sharing.AccessInheritance.Inherit.Instance;
            }
            this.Name              = name;
            this.Policy            = policy;
            this.PreviewUrl        = previewUrl;
            this.SharedFolderId    = sharedFolderId;
            this.TimeInvited       = timeInvited;
            this.LinkMetadata      = linkMetadata;
            this.Permissions       = permissionsList;
            this.AccessInheritance = accessInheritance;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the MemberActions in the
        /// request.</param>
        public SharedFolderMetadata(string name,
                                    string sharedFolderId,
                                    AccessLevel accessType,
                                    bool isTeamFolder,
                                    FolderPolicy policy,
                                    string pathLower = null,
                                    col.IEnumerable <FolderPermission> permissions = null)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            else if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId");
            }

            if (accessType == null)
            {
                throw new sys.ArgumentNullException("accessType");
            }

            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

            var permissionsList = enc.Util.ToList(permissions);

            this.Name           = name;
            this.SharedFolderId = sharedFolderId;
            this.AccessType     = accessType;
            this.IsTeamFolder   = isTeamFolder;
            this.Policy         = policy;
            this.PathLower      = pathLower;
            this.Permissions    = permissionsList;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="timeInvited">Timestamp indicating when the current user was invited to
        /// this shared folder.</param>
        /// <param name="previewUrl">URL for displaying a web preview of the shared
        /// folder.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the FolderActions in the
        /// request.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isTeamFolder,
                                    FolderPolicy policy,
                                    string name,
                                    string sharedFolderId,
                                    sys.DateTime timeInvited,
                                    string previewUrl,
                                    Dropbox.Api.Users.Team ownerTeam = null,
                                    string parentSharedFolderId      = null,
                                    string pathLower = null,
                                    col.IEnumerable <FolderPermission> permissions = null)
            : base(accessType, isTeamFolder, policy, ownerTeam, parentSharedFolderId)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'");
            }

            if (previewUrl == null)
            {
                throw new sys.ArgumentNullException("previewUrl");
            }

            var permissionsList = enc.Util.ToList(permissions);

            this.Name           = name;
            this.SharedFolderId = sharedFolderId;
            this.TimeInvited    = timeInvited;
            this.PreviewUrl     = previewUrl;
            this.PathLower      = pathLower;
            this.Permissions    = permissionsList;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public SharedFolderMetadata(string name,
                                    string sharedFolderId,
                                    AccessLevel accessType,
                                    bool isTeamFolder,
                                    FolderPolicy policy,
                                    string pathLower = null)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            else if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId");
            }

            if (accessType == null)
            {
                throw new sys.ArgumentNullException("accessType");
            }

            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

            this.Name           = name;
            this.SharedFolderId = sharedFolderId;
            this.AccessType     = accessType;
            this.IsTeamFolder   = isTeamFolder;
            this.Policy         = policy;
            this.PathLower      = pathLower;
        }
Example #9
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="id">The ID of the shared folder.</param>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        protected SharedFolderMetadata(string name,
                                       string id,
                                       AccessLevel accessType,
                                       bool isTeamFolder,
                                       FolderPolicy policy,
                                       string pathLower = null)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (id == null)
            {
                throw new sys.ArgumentNullException("id");
            }
            else if (!re.Regex.IsMatch(id, @"[-_0-9a-zA-Z]+"))
            {
                throw new sys.ArgumentOutOfRangeException("id");
            }

            if (accessType == null)
            {
                throw new sys.ArgumentNullException("accessType");
            }

            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

            this.Name         = name;
            this.Id           = id;
            this.AccessType   = accessType;
            this.IsTeamFolder = isTeamFolder;
            this.Policy       = policy;
            this.PathLower    = pathLower;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FullSharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="id">The ID of the shared folder.</param>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="membership">The list of user members of the shared folder.</param>
        /// <param name="groups">The list of group members of the shared folder.</param>
        /// <param name="invitees">The list of non-Dropbox users invited to join the shared
        /// folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public FullSharedFolderMetadata(string name,
                                        string id,
                                        AccessLevel accessType,
                                        bool isTeamFolder,
                                        FolderPolicy policy,
                                        col.IEnumerable <UserMembershipInfo> membership,
                                        col.IEnumerable <GroupMembershipInfo> groups,
                                        col.IEnumerable <InviteeMembershipInfo> invitees,
                                        string pathLower = null)
            : base(name, id, accessType, isTeamFolder, policy, pathLower)
        {
            var membershipList = new col.List <UserMembershipInfo>(membership ?? new UserMembershipInfo[0]);

            if (membership == null)
            {
                throw new sys.ArgumentNullException("membership");
            }

            var groupsList = new col.List <GroupMembershipInfo>(groups ?? new GroupMembershipInfo[0]);

            if (groups == null)
            {
                throw new sys.ArgumentNullException("groups");
            }

            var inviteesList = new col.List <InviteeMembershipInfo>(invitees ?? new InviteeMembershipInfo[0]);

            if (invitees == null)
            {
                throw new sys.ArgumentNullException("invitees");
            }

            this.Membership = membershipList;
            this.Groups     = groupsList;
            this.Invitees   = inviteesList;
        }
        /// <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="ownerDisplayNames">The display names of the users that own the file.
        /// If the file is part of a team folder, the display names of the team admins are also
        /// included. Absent if the owner display names cannot be fetched.</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,
                                  col.IEnumerable <string> ownerDisplayNames = 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 < 4)
            {
                throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 4");
            }
            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");
            }

            var ownerDisplayNamesList = enc.Util.ToList(ownerDisplayNames);

            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.OwnerDisplayNames    = ownerDisplayNamesList;
            this.OwnerTeam            = ownerTeam;
            this.ParentSharedFolderId = parentSharedFolderId;
            this.PathDisplay          = pathDisplay;
            this.PathLower            = pathLower;
            this.Permissions          = permissionsList;
            this.TimeInvited          = timeInvited;
        }