Esempio n. 1
0
        public static ChangeBatch GetCamlChangeBatch(this XElement xmlNode)
        {
            ChangeBatch changes = new ChangeBatch();

            if (xmlNode.Element(xmlNode.GetDefaultNamespace() + "Changes") != null)
            {
                changes.ChangeLog = xmlNode.Element(xmlNode.GetDefaultNamespace() + "Changes").GetCamlChangeLog();
            }
            else
            {
                changes.ChangeLog = new ChangeLog(new List <ChangeItem>());
            }

            if (xmlNode.GetNamespaceOfPrefix("rs") != null)
            {
                changes.ChangedItems = xmlNode.Element(xmlNode.GetNamespaceOfPrefix("rs") + "data").GetCamlListItemCollection();
            }
            else
            {
                changes.ChangedItems = new ListItemCollection(new List <ListItem>());
            }

            if (xmlNode.Attribute("MinTimeBetweenSyncs") != null)
            {
                changes.MinTimeBetweenSyncs         = Int32.Parse(xmlNode.Attribute("MinTimeBetweenSyncs").Value);
                changes.RecommendedTimeBetweenSyncs = Int32.Parse(xmlNode.Attribute("RecommendedTimeBetweenSyncs").Value);
            }
            return(changes);
        }
Esempio n. 2
0
        public static ChangeBatch GetCamlChangeBatch(this XElement xmlNode)
        {
            ChangeBatch changes = new ChangeBatch();

            if (xmlNode.Element(xmlNode.GetDefaultNamespace() + "Changes") != null)
                changes.ChangeLog = xmlNode.Element(xmlNode.GetDefaultNamespace() + "Changes").GetCamlChangeLog();
            else
                changes.ChangeLog = new ChangeLog(new List<ChangeItem>());

            if (xmlNode.GetNamespaceOfPrefix("rs") != null)
                changes.ChangedItems = xmlNode.Element(xmlNode.GetNamespaceOfPrefix("rs") + "data").GetCamlListItemCollection();
            else
                changes.ChangedItems = new ListItemCollection(new List<ListItem>());

            if (xmlNode.Attribute("MinTimeBetweenSyncs") != null)
            {
                changes.MinTimeBetweenSyncs = Int32.Parse(xmlNode.Attribute("MinTimeBetweenSyncs").Value);
                changes.RecommendedTimeBetweenSyncs = Int32.Parse(xmlNode.Attribute("RecommendedTimeBetweenSyncs").Value);
            }
            return changes;
        }
Esempio n. 3
0
        /// <summary>
        /// Calculates the next SpSyncAnchor from the current SpSyncAnchor object and the change batch just returned from the server
        /// </summary>
        /// <param name="currentAnchor">the current SpSyncAnchor object</param>
        /// <param name="changes"> the ChangeBatch object</param>
        /// <returns>the new SpSyncAnchor for the next incremental select</returns>
        protected SpSyncAnchor CalculateNextAnchor(SpSyncAnchor currentAnchor, ChangeBatch changes)
        {
            SpSyncAnchor nextChanges = currentAnchor.NextChangesAnchor ?? new SpSyncAnchor(changes.NextChangeBatch, null);
            SpSyncAnchor nextAnchor = nextChanges;

            if (changes.HasMoreData())
            {
                nextAnchor = new SpSyncAnchor(currentAnchor.NextChangesToken, changes.NextPage);
                nextAnchor.NextChangesAnchor = nextChanges;
            }
            nextAnchor.HasMoreData = changes.HasMoreChanges();
            return nextAnchor;
        }