Exemplo n.º 1
0
        /// <summary>
        /// Reads response elements from Json.
        /// </summary>
        /// <param name="responseObject">The response object.</param>
        /// <param name="service">The service.</param>
        internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service)
        {
            JsonObject rootFolder = responseObject.ReadAsJsonObject(XmlElementNames.RootFolder);

            this.results.TotalCount    = rootFolder.ReadAsInt(XmlAttributeNames.TotalItemsInView);
            this.results.MoreAvailable = rootFolder.ReadAsBool(XmlAttributeNames.IncludesLastItemInRange);

            // Ignore IndexedPagingOffset attribute if MoreAvailable is false.
            if (results.MoreAvailable)
            {
                if (rootFolder.ContainsKey(XmlAttributeNames.IndexedPagingOffset))
                {
                    this.results.NextPageOffset = rootFolder.ReadAsInt(XmlAttributeNames.IndexedPagingOffset);
                }
                else
                {
                    this.results.NextPageOffset = null;
                }
            }

            if (rootFolder.ContainsKey(XmlElementNames.Folders))
            {
                List <Folder> folders = new EwsServiceJsonReader(service).ReadServiceObjectsCollectionFromJson <Folder>(
                    rootFolder,
                    XmlElementNames.Folders,
                    this.CreateFolderInstance,
                    true,               /* clearPropertyBag */
                    this.propertySet,   /* requestedPropertySet */
                    true);              /* summaryPropertiesOnly */

                folders.ForEach((folder) => this.results.Folders.Add(folder));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads response elements from Json.
        /// </summary>
        /// <param name="responseObject">The response object.</param>
        /// <param name="service">The service.</param>
        internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service)
        {
            base.ReadElementsFromJson(responseObject, service);

            List <Folder> folders = new EwsServiceJsonReader(service).ReadServiceObjectsCollectionFromJson <Folder>(
                responseObject,
                XmlElementNames.Folders,
                this.GetObjectInstance,
                true,               /* clearPropertyBag */
                this.propertySet,   /* requestedPropertySet */
                false);             /* summaryPropertiesOnly */

            this.folder = folders[0];
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reads response elements from Json.
        /// </summary>
        /// <param name="responseObject">The response object.</param>
        /// <param name="service">The service.</param>
        internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service)
        {
            EwsServiceJsonReader jsonReader = new EwsServiceJsonReader(service);

            List <Item> items = jsonReader.ReadServiceObjectsCollectionFromJson <Item>(
                responseObject,
                XmlElementNames.Folders,
                this.GetObjectInstance,
                false,  /* clearPropertyBag */
                null,   /* requestedPropertySet */
                false); /* summaryPropertiesOnly */

            if (items.Count > 0)
            {
                this.item = items[0];
            }
        }
        /// <summary>
        /// Reads response elements from Json.
        /// </summary>
        /// <param name="responseObject">The response object.</param>
        /// <param name="service">The service.</param>
        internal override void ReadElementsFromJson(JsonObject responseObject, ExchangeService service)
        {
            EwsServiceJsonReader jsonReader = new EwsServiceJsonReader(service);

            List <Item> items = jsonReader.ReadServiceObjectsCollectionFromJson <Item>(
                responseObject,
                XmlElementNames.Folders,
                this.GetObjectInstance,
                false,  /* clearPropertyBag */
                null,   /* requestedPropertySet */
                false); /* summaryPropertiesOnly */

            // We only receive the copied or moved items if the copy or move operation was within
            // a single mailbox. No item is returned if the operation is cross-mailbox, from a
            // mailbox to a public folder or from a public folder to a mailbox.
            if (items.Count > 0)
            {
                this.item = items[0];
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service">The service.</param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            this.InternetMessageId = jsonProperty.ReadAsString(XmlElementNames.ConversationIndex);

            if (jsonProperty.ContainsKey(XmlElementNames.ParentInternetMessageId))
            {
                this.ParentInternetMessageId = jsonProperty.ReadAsString(XmlElementNames.ParentInternetMessageId);
            }

            if (jsonProperty.ContainsKey(XmlElementNames.Items))
            {
                EwsServiceJsonReader jsonReader = new EwsServiceJsonReader(service);

                this.Items = jsonReader.ReadServiceObjectsCollectionFromJson <Item>(
                    jsonProperty,
                    XmlElementNames.Items,
                    this.GetObjectInstance,
                    false,              /* clearPropertyBag */
                    this.propertySet,   /* requestedPropertySet */
                    false);             /* summaryPropertiesOnly */
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Read items from JSON.
        /// </summary>
        /// <param name="jsonObject">The JSON object containing items.</param>
        /// <param name="propertySet">The property set.</param>
        /// <param name="service">Exchange service.</param>
        /// <param name="destinationList">The list in which to add the read items.</param>
        private void InternalReadItemsFromJson(
            JsonObject jsonObject,
            PropertySet propertySet,
            ExchangeService service,
            IList <TItem> destinationList)
        {
            EwsUtilities.Assert(
                destinationList != null,
                "FindItemResponse.InternalReadItemsFromJson",
                "destinationList is null.");

            if (jsonObject.ContainsKey(XmlElementNames.Items))
            {
                List <TItem> items = new EwsServiceJsonReader(service).ReadServiceObjectsCollectionFromJson <TItem>(
                    jsonObject,
                    XmlElementNames.Items,
                    this.CreateItemInstance,
                    true,               /* clearPropertyBag */
                    this.propertySet,   /* requestedPropertySet */
                    true);              /* summaryPropertiesOnly */

                items.ForEach((item) => destinationList.Add(item));
            }
        }