public void MSOXWSSYNC_S04_TC01_SyncFolderItems_WithoutOptionalElements()
        {
            // Add drafts folder into list
            this.FolderIdNameType.Add(DistinguishedFolderIdNameType.drafts);
            SyncFolderItemsType[] request = new SyncFolderItemsType[this.FolderIdNameType.Count];

            for (int i = 0; i < this.FolderIdNameType.Count; i++)
            {
                request[i] = this.CreateSyncFolderItemsRequestWithoutOptionalElements(this.FolderIdNameType[i], DefaultShapeNamesType.AllProperties);
            }

            this.VerifySyncFolderItemsOperation(request, false);
        }
示例#2
0
        /// <summary>
        /// Gets synchronization information that enables items to be synchronized between a client and a server.
        /// </summary>
        /// <param name="request">A request to the SyncFolderItems operation.</param>
        /// <returns>A response from the SyncFolderItems operation.</returns>
        public SyncFolderItemsResponseType SyncFolderItems(SyncFolderItemsType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The SyncFolderItems request should not be null.");
            }

            SyncFolderItemsResponseType response = this.exchangeServiceBinding.SyncFolderItems(request);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifySyncFolderItemsResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
        public void MSOXWSSYNC_S04_TC02_SyncFolderItems_WithAllOptionalElements()
        {
            // Add drafts folder into list
            this.FolderIdNameType.Add(DistinguishedFolderIdNameType.drafts);
            SyncFolderItemsType[] request = new SyncFolderItemsType[this.FolderIdNameType.Count];

            for (int i = 0; i < this.FolderIdNameType.Count; i++)
            {
                request[i] = this.CreateSyncFolderItemsRequestWithoutOptionalElements(this.FolderIdNameType[i], DefaultShapeNamesType.IdOnly);

                if (Common.IsRequirementEnabled(37811008, this.Site))
                {
                    request[i].SyncScopeSpecified = true;
                    request[i].SyncScope          = SyncFolderItemsScopeType.NormalItems;
                }

                // Set the value of SyncState element and Ignore element
                request[i].SyncState = string.Empty;

                // It will be rewrite to a new value in test case
                request[i].Ignore = null;

                // Set the value of AdditionalProperties element
                request[i].ItemShape.AdditionalProperties = new BasePathToElementType[]
                {
                    new PathToUnindexedFieldType
                    {
                        FieldURI = UnindexedFieldURIType.itemSubject
                    }
                };

                if (Common.IsRequirementEnabled(37809, this.Site))
                {
                    request[i].ItemShape.InlineImageUrlTemplate = "Test Template";
                }
            }

            this.VerifySyncFolderItemsOperation(request, true);
        }
 /// <remarks/>
 public void SyncFolderItemsAsync(SyncFolderItemsType SyncFolderItems1, object userState)
 {
     if ((this.SyncFolderItemsOperationCompleted == null))
     {
         this.SyncFolderItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSyncFolderItemsOperationCompleted);
     }
     this.InvokeAsync("SyncFolderItems", new object[] {
                 SyncFolderItems1}, this.SyncFolderItemsOperationCompleted, userState);
 }
 /// <remarks/>
 public void SyncFolderItemsAsync(SyncFolderItemsType SyncFolderItems1)
 {
     this.SyncFolderItemsAsync(SyncFolderItems1, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginSyncFolderItems(SyncFolderItemsType SyncFolderItems1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("SyncFolderItems", new object[] {
                 SyncFolderItems1}, callback, asyncState);
 }
示例#7
0
		public Changes GetChanges(int numberOfItems, string syncState)
		{
			SyncFolderItemsType request = new SyncFolderItemsType
			{
				ItemShape = ExchangeService.IdOnlyShape,
				SyncFolderId = new TargetFolderIdType
				{
					Item = this.folderId
				},
				SyncState = syncState,
				Ignore = null,
				MaxChangesReturned = numberOfItems,
				SyncScope = SyncFolderItemsScopeType.NormalItems
			};
			SyncFolderItemsResponseMessageType syncFolderItemsResponseMessageType = this.SyncFolderItems(request);
			if (string.IsNullOrEmpty(syncFolderItemsResponseMessageType.SyncState))
			{
				ExchangeService.Tracer.TraceError<ExchangeService>((long)this.GetHashCode(), "{0}: sync state is missing", this);
				throw new UnexpectedRemoteDataException(new ResponseMessageType[]
				{
					syncFolderItemsResponseMessageType
				});
			}
			List<ItemChange> list = new List<ItemChange>(numberOfItems);
			if (syncFolderItemsResponseMessageType.Changes != null && syncFolderItemsResponseMessageType.Changes.Items != null)
			{
				int i = 0;
				while (i < syncFolderItemsResponseMessageType.Changes.Items.Length)
				{
					ItemChangeType itemChangeType;
					switch (syncFolderItemsResponseMessageType.Changes.ItemsElementName[i])
					{
					case ItemsChoiceType2.Create:
						itemChangeType = ItemChangeType.Create;
						goto IL_120;
					case ItemsChoiceType2.Delete:
						itemChangeType = ItemChangeType.Delete;
						goto IL_120;
					case ItemsChoiceType2.ReadFlagChange:
						break;
					case ItemsChoiceType2.Update:
						itemChangeType = ItemChangeType.Update;
						goto IL_120;
					default:
						ExchangeService.Tracer.TraceDebug<ExchangeService, ItemsChoiceType2>((long)this.GetHashCode(), "{0}: unknown change type, ignoring: {1}", this, syncFolderItemsResponseMessageType.Changes.ItemsElementName[i]);
						break;
					}
					IL_25F:
					i++;
					continue;
					IL_120:
					ItemIdType itemIdType = null;
					switch (itemChangeType)
					{
					case ItemChangeType.Create:
					case ItemChangeType.Update:
					{
						SyncFolderItemsCreateOrUpdateType syncFolderItemsCreateOrUpdateType = syncFolderItemsResponseMessageType.Changes.Items[i] as SyncFolderItemsCreateOrUpdateType;
						if (syncFolderItemsCreateOrUpdateType == null || syncFolderItemsCreateOrUpdateType.Item == null || syncFolderItemsCreateOrUpdateType.Item.ItemId == null)
						{
							ExchangeService.Tracer.TraceError<ExchangeService, int>((long)this.GetHashCode(), "{0}: ignoring item {1} change because of missing data", this, i);
							goto IL_25F;
						}
						itemIdType = syncFolderItemsCreateOrUpdateType.Item.ItemId;
						break;
					}
					case ItemChangeType.Delete:
					{
						SyncFolderItemsDeleteType syncFolderItemsDeleteType = syncFolderItemsResponseMessageType.Changes.Items[i] as SyncFolderItemsDeleteType;
						if (syncFolderItemsDeleteType == null || syncFolderItemsDeleteType.ItemId == null)
						{
							ExchangeService.Tracer.TraceError<ExchangeService, int>((long)this.GetHashCode(), "{0}: ignoring item {1} change because of missing data", this, i);
						}
						itemIdType = syncFolderItemsDeleteType.ItemId;
						break;
					}
					}
					if (itemIdType == null || string.IsNullOrEmpty(itemIdType.Id))
					{
						ExchangeService.Tracer.TraceError<ExchangeService, int>((long)this.GetHashCode(), "{0}: ignoring item {1} change without id", this, i);
						goto IL_25F;
					}
					ExchangeService.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: item {1} change {2} of item {3}", new object[]
					{
						this,
						i,
						itemChangeType,
						itemIdType.Id
					});
					list.Add(new ItemChange(itemChangeType, itemIdType));
					goto IL_25F;
				}
			}
			return new Changes(syncFolderItemsResponseMessageType.SyncState, syncFolderItemsResponseMessageType.IncludesLastItemInRangeSpecified && !syncFolderItemsResponseMessageType.IncludesLastItemInRange, list.ToArray());
		}
示例#8
0
		private SyncFolderItemsResponseMessageType SyncFolderItems(SyncFolderItemsType request)
		{
			return this.ExecuteWebMethodSingleResponse<SyncFolderItemsResponseMessageType>(() => this.binding.SyncFolderItems(request));
		}