Example #1
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)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.DayOfWeek:
                    EwsUtilities.ParseEnumValueList <DayOfTheWeek>(
                        this.daysOfWeek,
                        jsonProperty.ReadAsString(key),
                        ' ');
                    break;

                case XmlElementNames.StartTimeInMinutes:
                    this.startTime = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key));
                    break;

                case XmlElementNames.EndTimeInMinutes:
                    this.endTime = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key));
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.Bias:
                    this.delta = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key));
                    break;

                case XmlElementNames.Time:
                    this.timeOfDay = TimeSpan.Parse(jsonProperty.ReadAsString(key));
                    break;

                case XmlElementNames.DayOrder:
                    this.dayOrder = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.DayOfWeek:
                    this.dayOfTheWeek = jsonProperty.ReadEnumValue <DayOfTheWeek>(key);
                    break;

                case XmlElementNames.Month:
                    this.month = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.Year:
                    this.year = jsonProperty.ReadAsInt(key);
                    break;

                default:
                    break;
                }
            }
        }
Example #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)
        {
            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));
            }
        }
Example #4
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.NumberOfMembers:
                    this.numberOfMembers = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.NumberOfMembersAvailable:
                    this.numberOfMembersAvailable = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.NumberOfMembersWithConflict:
                    this.numberOfMembersWithConflict = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.NumberOfMembersWithNoData:
                    this.numberOfMembersWithNoData = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.BusyType:
                    this.freeBusyStatus = jsonProperty.ReadEnumValue <LegacyFreeBusyStatus>(key);
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.CanDelete:
                    this.canDelete = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.CanRenameOrMove:
                    this.canRenameOrMove = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.MustDisplayComment:
                    this.mustDisplayComment = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.HasQuota:
                    this.hasQuota = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.IsManagedFoldersRoot:
                    this.isManagedFoldersRoot = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.ManagedFolderId:
                    this.managedFolderId = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.Comment:
                    string commentValue = jsonProperty.ReadAsString(key);
                    if (commentValue != null)
                    {
                        this.comment = commentValue;
                    }
                    break;

                case XmlElementNames.StorageQuota:
                    this.storageQuota = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.FolderSize:
                    this.folderSize = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.HomePage:
                    string homePageValue = jsonProperty.ReadAsString(key);
                    if (homePageValue != null)
                    {
                        this.homePage = homePageValue;
                    }
                    break;

                default:
                    break;
                }
            }
        }
        /// <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)
        {
            EwsUtilities.Assert(
                this.Results.Conversations != null,
                "FindConversationResponse.ReadElementsFromXml",
                "conversations is null.");

            EwsUtilities.Assert(
                this.Results.HighlightTerms != null,
                "FindConversationResponse.ReadElementsFromXml",
                "highlightTerms is null.");

            foreach (object conversationObject in responseObject.ReadAsArray(XmlElementNames.Conversations))
            {
                JsonObject jsonConversation = conversationObject as JsonObject;

                Conversation item = EwsUtilities.CreateEwsObjectFromXmlElementName <Conversation>(service, XmlElementNames.Conversation);

                if (item != null)
                {
                    item.LoadFromJson(
                        jsonConversation,
                        service,
                        true,
                        null,
                        false);

                    this.Conversations.Add(item);
                }
            }

            Object[] highlightTermObjects = responseObject.ReadAsArray(XmlElementNames.HighlightTerms);
            if (highlightTermObjects != null)
            {
                foreach (object highlightTermObject in highlightTermObjects)
                {
                    JsonObject    jsonHighlightTerm = highlightTermObject as JsonObject;
                    HighlightTerm term = new HighlightTerm();

                    term.LoadFromJson(jsonHighlightTerm, service);
                    this.Results.HighlightTerms.Add(term);
                }
            }

            if (responseObject.ContainsKey(XmlElementNames.TotalConversationsInView))
            {
                this.Results.TotalCount = responseObject.ReadAsInt(XmlElementNames.TotalConversationsInView);
            }

            if (responseObject.ContainsKey(XmlElementNames.IndexedOffset))
            {
                this.Results.IndexedOffset = responseObject.ReadAsInt(XmlElementNames.IndexedOffset);
            }
        }
        /// <summary>
        /// Parses the specified json object.
        /// </summary>
        /// <param name="jsonObject">The json object.</param>
        /// <returns></returns>
        internal static ExchangeServerInfo Parse(JsonObject jsonObject)
        {
            ExchangeServerInfo info = new ExchangeServerInfo();

            info.MajorVersion     = jsonObject.ReadAsInt("MajorVersion");
            info.MinorVersion     = jsonObject.ReadAsInt("MinorVersion");
            info.MajorBuildNumber = jsonObject.ReadAsInt("MajorBuildNumber");
            info.MinorBuildNumber = jsonObject.ReadAsInt("MinorBuildNumber");
            info.VersionString    = jsonObject.ReadAsString("Version");
            return(info);
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonObject">The json object.</param>
        internal void LoadFromJson(JsonObject jsonObject)
        {
            foreach (string key in jsonObject.Keys)
            {
                switch (key)
                {
                case XmlAttributeNames.DistinguishedPropertySetId:
                    this.propertySet = jsonObject.ReadEnumValue <DefaultExtendedPropertySet>(key);
                    break;

                case XmlAttributeNames.PropertySetId:
                    this.propertySetId = new Guid(jsonObject.ReadAsString(key));
                    break;

                case XmlAttributeNames.PropertyTag:
                    this.tag = Convert.ToUInt16(jsonObject.ReadAsString(key), 16);
                    break;

                case XmlAttributeNames.PropertyName:
                    this.name = jsonObject.ReadAsString(key);
                    break;

                case XmlAttributeNames.PropertyId:
                    this.id = jsonObject.ReadAsInt(key);
                    break;

                case XmlAttributeNames.PropertyType:
                    this.mapiType = jsonObject.ReadEnumValue <MapiPropertyType>(key);
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            base.LoadFromJson(jsonProperty, service);

            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.AttachLongPathName:
                    this.attachLongPathName = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.ProviderType:
                    this.providerType = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.PermissionType:
                    this.PermissionType = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.AttachmentIsFolder:
                    this.AttachmentIsFolder = jsonProperty.ReadAsBool(key);
                    break;

                default:
                    break;
                }
            }
        }
Example #10
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonEvent">The json event.</param>
        /// <param name="service">The service.</param>
        internal override void LoadFromJson(JsonObject jsonEvent, ExchangeService service)
        {
            this.folderId = new FolderId();
            this.folderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.FolderId), service);

            this.ParentFolderId = new FolderId();
            this.ParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.ParentFolderId), service);

            switch (this.EventType)
            {
            case EventType.Moved:
            case EventType.Copied:

                this.oldFolderId = new FolderId();
                this.oldFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(JsonNames.OldFolderId), service);

                this.OldParentFolderId = new FolderId();
                this.OldParentFolderId.LoadFromJson(jsonEvent.ReadAsJsonObject(XmlElementNames.OldParentFolderId), service);
                break;

            case EventType.Modified:
                if (jsonEvent.ContainsKey(XmlElementNames.UnreadCount))
                {
                    this.unreadCount = jsonEvent.ReadAsInt(XmlElementNames.UnreadCount);
                }
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.Bias:
                    this.bias = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key));
                    break;

                case XmlElementNames.StandardTime:
                    this.standardTime = new LegacyAvailabilityTimeZoneTime();
                    this.standardTime.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                case XmlElementNames.DaylightTime:
                    this.daylightTime = new LegacyAvailabilityTimeZoneTime();
                    this.daylightTime.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                default:
                    break;
                }
            }
        }
Example #12
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.PhoneCallState:
                    this.state = jsonProperty.ReadEnumValue <PhoneCallState>(key);
                    break;

                case XmlElementNames.ConnectionFailureCause:
                    this.connectionFailureCause = jsonProperty.ReadEnumValue <ConnectionFailureCause>(key);
                    break;

                case XmlElementNames.SIPResponseText:
                    this.sipResponseText = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.SIPResponseCode:
                    this.sipResponseCode = jsonProperty.ReadAsInt(key);
                    break;

                default:
                    break;
                }
            }
        }
Example #13
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)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.IsUndecidedApprovalRequest:
                    this.isUndecidedApprovalRequest = jsonProperty.ReadAsBool(key);
                    break;

                case XmlElementNames.ApprovalDecision:
                    this.approvalDecision = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.ApprovalDecisionMaker:
                    this.approvalDecisionMaker = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.ApprovalDecisionTime:
                    this.approvalDecisionTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value;
                    break;

                default:
                    break;
                }
            }
        }
Example #14
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)
        {
            if (jsonProperty.ContainsKey(XmlElementNames.OperationIndex))
            {
                this.operationIndex = jsonProperty.ReadAsInt(XmlElementNames.OperationIndex);
            }

            if (jsonProperty.ContainsKey(XmlElementNames.ValidationErrors))
            {
                this.ruleErrors = new RuleErrorCollection();
                (this.ruleErrors as IJsonCollectionDeserializer).CreateFromJsonCollection(jsonProperty.ReadAsArray(XmlElementNames.ValidationErrors), service);
            }
        }
        /// <summary>
        /// Load from json.
        /// </summary>
        /// <param name="jsonObject">The json object.</param>
        /// <returns>Retention policy tag object.</returns>
        internal static RetentionPolicyTag LoadFromJson(JsonObject jsonObject)
        {
            RetentionPolicyTag retentionPolicyTag = new RetentionPolicyTag();

            if (jsonObject.ContainsKey(XmlElementNames.DisplayName))
            {
                retentionPolicyTag.DisplayName = jsonObject.ReadAsString(XmlElementNames.DisplayName);
            }

            if (jsonObject.ContainsKey(XmlElementNames.RetentionId))
            {
                retentionPolicyTag.RetentionId = new Guid(jsonObject.ReadAsString(XmlElementNames.RetentionId));
            }

            if (jsonObject.ContainsKey(XmlElementNames.RetentionPeriod))
            {
                retentionPolicyTag.RetentionPeriod = jsonObject.ReadAsInt(XmlElementNames.RetentionPeriod);
            }

            if (jsonObject.ContainsKey(XmlElementNames.Type))
            {
                retentionPolicyTag.Type = jsonObject.ReadEnumValue <ElcFolderType>(XmlElementNames.Type);
            }

            if (jsonObject.ContainsKey(XmlElementNames.RetentionAction))
            {
                retentionPolicyTag.RetentionAction = jsonObject.ReadEnumValue <RetentionActionType>(XmlElementNames.RetentionAction);
            }

            if (jsonObject.ContainsKey(XmlElementNames.Description))
            {
                retentionPolicyTag.Description = jsonObject.ReadAsString(XmlElementNames.Description);
            }

            if (jsonObject.ContainsKey(XmlElementNames.IsVisible))
            {
                retentionPolicyTag.IsVisible = jsonObject.ReadAsBool(XmlElementNames.IsVisible);
            }

            if (jsonObject.ContainsKey(XmlElementNames.OptedInto))
            {
                retentionPolicyTag.OptedInto = jsonObject.ReadAsBool(XmlElementNames.OptedInto);
            }

            if (jsonObject.ContainsKey(XmlElementNames.IsArchive))
            {
                retentionPolicyTag.IsArchive = jsonObject.ReadAsBool(XmlElementNames.IsArchive);
            }

            return(retentionPolicyTag);
        }
Example #16
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);

            if (responseObject.ContainsKey(XmlElementNames.Token))
            {
                JsonObject jsonObject = responseObject.ReadAsJsonObject(XmlElementNames.Token);

                this.Id         = jsonObject.ReadAsString(XmlElementNames.Id);
                this.TokenType  = (ClientAccessTokenType)Enum.Parse(typeof(ClientAccessTokenType), jsonObject.ReadAsString(XmlElementNames.TokenType));
                this.TokenValue = jsonObject.ReadAsString(XmlElementNames.TokenValue);
                this.TTL        = jsonObject.ReadAsInt(XmlElementNames.TTL);
            }
        }
            /// <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)
            {
                base.LoadFromJson(jsonProperty, service);

                foreach (string key in jsonProperty.Keys)
                {
                    switch (key)
                    {
                        case XmlElementNames.Interval:
                            this.interval = jsonProperty.ReadAsInt(key);
                            break;
                        default:
                            break;
                    }
                }
            }
Example #18
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.AttachmentId:
                    this.LoadAttachmentIdFromJson(jsonProperty.ReadAsJsonObject(key));
                    break;

                case XmlElementNames.Name:
                    this.name = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.ContentType:
                    this.contentType = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.ContentId:
                    this.contentId = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.ContentLocation:
                    this.contentLocation = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.Size:
                    this.size = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.LastModifiedTime:
                    this.lastModifiedTime = service.ConvertUniversalDateTimeStringToLocalDateTime(jsonProperty.ReadAsString(key)).Value;
                    break;

                case XmlElementNames.IsInline:
                    this.isInline = jsonProperty.ReadAsBool(key);
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// Loads from json array.
        /// </summary>
        /// <param name="jsonProperty">The p.</param>
        /// <param name="service">The service.</param>
        internal void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            int totalItemsInView;

            object[] resolutions;

            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlAttributeNames.TotalItemsInView:
                    totalItemsInView = jsonProperty.ReadAsInt(key);
                    break;

                case XmlAttributeNames.IncludesLastItemInRange:
                    this.includesAllResolutions = jsonProperty.ReadAsBool(key);
                    break;

                // This label only exists for Json objects.  The XML doesn't have a "Resolutions"
                // element.
                // This was necessary becaue of the lack of attributes in JSON
                //
                case "Resolutions":
                    resolutions = jsonProperty.ReadAsArray(key);
                    foreach (object resolution in resolutions)
                    {
                        JsonObject resolutionProperty = resolution as JsonObject;
                        if (resolutionProperty != null)
                        {
                            NameResolution nameResolution = new NameResolution(this);
                            nameResolution.LoadFromJson(resolutionProperty, service);
                            this.items.Add(nameResolution);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Example #20
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)
            {
                base.LoadFromJson(jsonProperty, service);

                foreach (string key in jsonProperty.Keys)
                {
                    switch (key)
                    {
                    case XmlElementNames.DayOfMonth:
                        this.dayOfMonth = jsonProperty.ReadAsInt(key);
                        break;

                    case XmlElementNames.Month:
                        this.month = jsonProperty.ReadEnumValue <Month>(key);
                        break;

                    default:
                        break;
                    }
                }
            }
Example #21
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);

            JsonObject rootFolder         = responseObject.ReadAsJsonObject(XmlElementNames.RootFolder);
            int        totalItemsInView   = rootFolder.ReadAsInt(XmlAttributeNames.TotalItemsInView);
            bool       moreItemsAvailable = !rootFolder.ReadAsBool(XmlAttributeNames.IncludesLastItemInRange);

            // Ignore IndexedPagingOffset attribute if moreItemsAvailable is false.
            int?nextPageOffset = null;

            if (moreItemsAvailable)
            {
                if (rootFolder.ContainsKey(XmlAttributeNames.IndexedPagingOffset))
                {
                    nextPageOffset = rootFolder.ReadAsInt(XmlAttributeNames.IndexedPagingOffset);
                }
            }

            if (!this.isGrouped)
            {
                this.results                = new FindItemsResults <TItem>();
                this.results.TotalCount     = totalItemsInView;
                this.results.NextPageOffset = nextPageOffset;
                this.results.MoreAvailable  = moreItemsAvailable;
                this.InternalReadItemsFromJson(
                    rootFolder,
                    this.propertySet,
                    service,
                    this.results.Items);
            }
            else
            {
                this.groupedFindResults                = new GroupedFindItemsResults <TItem>();
                this.groupedFindResults.TotalCount     = totalItemsInView;
                this.groupedFindResults.NextPageOffset = nextPageOffset;
                this.groupedFindResults.MoreAvailable  = moreItemsAvailable;

                if (rootFolder.ContainsKey(XmlElementNames.Groups))
                {
                    object[] jsGroups = rootFolder.ReadAsArray(XmlElementNames.Groups);

                    foreach (JsonObject jsGroup in jsGroups.OfType <JsonObject>())
                    {
                        if (jsGroup.ContainsKey(XmlElementNames.GroupedItems))
                        {
                            JsonObject jsGroupedItems = jsGroup.ReadAsJsonObject(XmlElementNames.GroupedItems);

                            string groupIndex = jsGroupedItems.ReadAsString(XmlElementNames.GroupIndex);

                            List <TItem> itemList = new List <TItem>();
                            this.InternalReadItemsFromJson(
                                jsGroupedItems,
                                this.propertySet,
                                service,
                                itemList);

                            this.groupedFindResults.ItemGroups.Add(new ItemGroup <TItem>(groupIndex, itemList));
                        }
                    }
                }
            }

            Object[] highlightTermObjects = responseObject.ReadAsArray(XmlElementNames.HighlightTerms);
            if (highlightTermObjects != null)
            {
                foreach (object highlightTermObject in highlightTermObjects)
                {
                    JsonObject    jsonHighlightTerm = highlightTermObject as JsonObject;
                    HighlightTerm term = new HighlightTerm();

                    term.LoadFromJson(jsonHighlightTerm, service);
                    this.results.HighlightTerms.Add(term);
                }
            }
        }