/// <summary>
        /// Creates a request for the SyncFolderHierarchy operation.
        /// </summary>
        /// <param name="folder">A default folder name.</param>
        /// <param name="defaultShapeNames">Standard sets of properties to return.</param>
        /// <param name="isSyncFolderIdPresent">A Boolean value indicates whether the SyncFolderId element present in the request.</param>
        /// <param name="isSyncStatePresent">A Boolean value indicates whether the SyncState element present in the request.</param>
        /// <returns>An instance of SyncFolderHierarchyType used by the SyncFolderHierarchy operation.</returns>
        public static SyncFolderHierarchyType CreateSyncFolderHierarchyRequest(
            DistinguishedFolderIdNameType folder,
            DefaultShapeNamesType defaultShapeNames,
            bool isSyncFolderIdPresent,
            bool isSyncStatePresent)
        {
            // Create an instance of SyncFolderHierarchyType
            SyncFolderHierarchyType request = new SyncFolderHierarchyType();

            request.FolderShape           = new FolderResponseShapeType();
            request.FolderShape.BaseShape = defaultShapeNames;

            // Set the value of SyncFolderId if this element is present in the request.
            if (isSyncFolderIdPresent)
            {
                request.SyncFolderId = new TargetFolderIdType();
                DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
                distinguishedFolderId.Id  = folder;
                request.SyncFolderId.Item = distinguishedFolderId;
            }

            // Set the value of SyncState element if this element is present in the request.
            if (isSyncStatePresent)
            {
                request.SyncState = string.Empty;
            }

            return(request);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="baseShape">BaseShape associated with this response shape</param>
 /// <param name="additionalProperties">OPTIONAL list of additional properties for this shape</param>
 /// 
 public FolderResponseShapeType(DefaultShapeNamesType baseShape, params BasePathToElementType[] additionalProperties)
 {
     this.BaseShape = baseShape;
     if ((additionalProperties != null) && (additionalProperties.Length > 0))
     {
         this.AdditionalProperties = additionalProperties;
     }
 }
Example #3
0
        /// <summary>
        /// Define general GetItem request message
        /// </summary>
        /// <param name="itemId">The item identifier of the item.</param>
        /// <param name="baseShape">The basic configuration of properties to be returned in an item response.</param>
        /// <returns>A request to get an item from a mailbox</returns>
        protected GetItemType DefineGeneralGetItemRequestMessage(ItemIdType itemId, DefaultShapeNamesType baseShape)
        {
            GetItemType getItemRequest = new GetItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemId
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = baseShape,
                }
            };

            return(getItemRequest);
        }
        /// <summary>
        /// Generate the request message for operation "GetFolder".
        /// </summary>
        /// <param name="shapeName">The properties to include in the response.</param>
        /// <param name="folderIds">An array of folder identifiers.</param>   
        /// <returns>Get folder request instance that will send to server.</returns>
        protected GetFolderType GetGetFolderRequest(DefaultShapeNamesType shapeName, params BaseFolderIdType[] folderIds)
        {
            Site.Assert.IsNotNull(folderIds, "Folders id should not be null!");
            Site.Assert.AreNotEqual<int>(0, folderIds.Length, "Folders id should contains at least one Id!");
            GetFolderType getFolderRequest = new GetFolderType();

            // Specify how many folders need to be gotten.
            int folderCount = folderIds.Length;

            // Set the request's folderId.
            getFolderRequest.FolderIds = new BaseFolderIdType[folderCount];

            for (int folderIdIndex = 0; folderIdIndex < folderCount; folderIdIndex++)
            {
                getFolderRequest.FolderIds[folderIdIndex] = folderIds[folderIdIndex];
            }

            // Set folder shape.
            getFolderRequest.FolderShape = new FolderResponseShapeType();
            getFolderRequest.FolderShape.BaseShape = shapeName;
            return getFolderRequest;
        }
        /// <summary>
        /// Define general GetItem request message
        /// </summary>
        /// <param name="itemId">The item identifier of the item.</param>
        /// <param name="baseShape">The basic configuration of properties to be returned in an item response.</param>
        /// <returns>A request to get an item from a mailbox</returns>
        protected GetItemType DefineGeneralGetItemRequestMessage(ItemIdType itemId, DefaultShapeNamesType baseShape)
        {
            GetItemType getItemRequest = new GetItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemId
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = baseShape,
                }
            };

            return getItemRequest;
        }