/// <remarks/> public void GetItemFieldsAsync(string id, string language, string version, bool allFields, string databaseName, Credentials credentials, object userState) { if ((this.GetItemFieldsOperationCompleted == null)) { this.GetItemFieldsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetItemFieldsOperationCompleted); } this.InvokeAsync("GetItemFields", new object[] { id, language, version, allFields, databaseName, credentials}, this.GetItemFieldsOperationCompleted, userState); }
/// <remarks/> public void VerifyCredentialsAsync(Credentials credentials) { this.VerifyCredentialsAsync(credentials, null); }
private Sitecore5xItem(XmlNode itemNode, IItem parent, Sitecore5x.VisualSitecoreService sitecoreApi, Sitecore5x.Credentials credentials) { _Parent = parent; _sitecoreApi = sitecoreApi; _credentials = credentials; _ID = new Guid(itemNode.Attributes["id"].Value); _sName = itemNode.Attributes["name"].Value; _sKey = itemNode.Attributes["key"].Value; _TemplateID = new Guid(itemNode.Attributes["tid"].Value); _sTemplateName = itemNode.Attributes["template"].Value; // If basetemplate isn't defined use _TemplateID otherwise extract list of inherited templates XmlNode baseTemplateNode = itemNode.SelectSingleNode("//field[@key='__base template']/content"); if (baseTemplateNode == null) { _sTemplateIDs = new string[1]; // If template is "template" then there is an error in sitecore webservice and // we change it to "Standard template". if (Util.GuidToSitecoreID(_TemplateID) == "{AB86861A-6030-46C5-B394-E8F99E8B87DB}") _sTemplateIDs[0] = "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"; else _sTemplateIDs[0] = Util.GuidToSitecoreID(_TemplateID); } else _sTemplateIDs = baseTemplateNode.InnerText.Split('|'); // _sParentID = itemNode.Attributes["parentid"].Value; _sSortOrder = Util.GetNodeFieldValue(itemNode, "//field[@key='__sortorder']/content"); if ((itemNode.Attributes["haschildren"] != null) && (itemNode.Attributes["haschildren"].Value == "1")) _bHasChildren = true; _sPath = ""; string sLatestVersion = "1"; XmlNodeList versions = itemNode.SelectNodes("//version[@language = '" + this.Options.Language + "']"); if (versions != null && versions.Count > 0) sLatestVersion = versions[versions.Count - 1].SelectSingleNode("@version").Value; XmlNode contentNode = _sitecoreApi.GetItemFields(Util.GuidToSitecoreID(_ID), this.Options.Language, sLatestVersion, false, Util.CurrentDatabase, _credentials); XmlNodeList paths = contentNode.SelectNodes("/path/item"); foreach (XmlNode path in paths) { if (_sPath == "") _sPath = "/" + path.Attributes["name"].Value; else _sPath = "/" + path.Attributes["name"].Value + _sPath; } // The program always assumes that all fields exists, so the fieldvalues could be empty in // order to prevent copying to another language. XmlNodeList fieldList = itemNode.SelectNodes("version[@language='" + this.Options.Language + "' and @version = '"+sLatestVersion+"']/fields/field"); foreach (XmlNode node in fieldList) { Sitecore5xField field = new Sitecore5xField(node); var existingfields = from f in _fields where f.TemplateFieldID == field.TemplateFieldID select f; if (existingfields.Count() == 0) { // The content is cleared because it is from another language layer // field.Content = ""; if (field.Name.ToLower() == "__icon") _sIcon = field.Content; if (field.Name.ToLower() == "__sortorder") _sSortOrder = field.Content; if ((field.Name.ToLower() == "__display name") && (field.Content != "")) _sName = field.Content; // Skip security field, it is copied in the extended sitecoreApi if (field.Name.ToLower() == "__security") continue; // Skip standard values, it's set in the extended sitecoreApi if (field.Name.ToLower() == "__standard values") continue; // Caching of template fields items XmlNode templateFieldNode = null; if (!_Options.ExistingTemplateFields.TryGetValue(field.TemplateFieldID, out templateFieldNode)) { try { templateFieldNode = GetItemXml(field.TemplateFieldID); _Options.ExistingTemplateFields.Add(field.TemplateFieldID, templateFieldNode); } catch (Exception ex) { if (ex.Message.ToLower().IndexOf("object reference not set to an instance of an object.") > -1) { // Do nothing this happens when there is content that is missing it's template field (probably the whole template) continue; } else throw new Exception("Error retrieving sitecore Field.", ex); } } field.SortOrder = templateFieldNode.Attributes["sortorder"].Value; field.Name = templateFieldNode.Attributes["name"].Value; // Get section from contentNode XmlNode fieldNode = contentNode.SelectSingleNode("/field[@fieldid='" + field.TemplateFieldID + "']"); if ((fieldNode != null) && (fieldNode.Attributes["section"] != null)) field.Section = fieldNode.Attributes["section"].Value; _fields.Add(field); } } // This is a template item if ((_sPath.ToLower().IndexOf("/sitecore/templates") > -1) && (_sName != "__Standard Values")) { XmlNode childrenNode = _sitecoreApi.GetChildren("{" + _ID.ToString().ToUpper() + "}", Util.CurrentDatabase, _credentials); XmlNodeList nodeList = childrenNode.SelectNodes("./item"); foreach (XmlNode node in nodeList) { // Get full-blown item XmlNode item = GetItemXml(node.Attributes["id"].Value); string sSection = ""; if (item.Attributes["template"].Value == "template section") { sSection = item.Attributes["name"].Value; XmlNode sectionChildNodes = _sitecoreApi.GetChildren(node.Attributes["id"].Value, Util.CurrentDatabase, _credentials); foreach (XmlNode tempNode in sectionChildNodes.SelectNodes("./item")) { XmlNode templateFieldNode = GetItemXml(tempNode.Attributes["id"].Value); Sitecore5xField field = new Sitecore5xField( templateFieldNode.Attributes["name"].Value, templateFieldNode.Attributes["name"].Value.ToLower(), Util.GetNodeFieldValue(templateFieldNode, "//field[@key='type']/content"), new Guid(templateFieldNode.Attributes["id"].Value), "", Util.GetNodeFieldValue(templateFieldNode, "//field[@key='__sortorder']/content"), sSection); field.Source = Util.GetNodeFieldValue(templateFieldNode, "//field[@key='source']/content"); field.LanguageTitle = Util.GetNodeFieldValue(templateFieldNode, "//field[@key='title']/content"); var existingfields = from f in _fields where f.TemplateFieldID == field.TemplateFieldID select f; if (existingfields.Count() == 0) { _fields.Add(field); } } } // Clear template items values, will be fille later with standard values // foreach (Sitecore5xField field in _fields) // field.Content = ""; } // Fill template field values with standard values Sitecore5xItem standardValueItem = GetSitecore5xItem(_sPath + "/__Standard Values"); if (standardValueItem != null) { foreach (Sitecore5xField standardField in standardValueItem._fields) { // Add field values from this and inherited templates Sitecore5xField curField = Util.GetFieldByID(standardField.TemplateFieldID, Fields) as Sitecore5xField; if (curField == null) _fields.Add(standardField); else curField.Content = standardField.Content; } } } // This is a "__Standard Values" item for the current language layer else if ((_sPath.ToLower().IndexOf("/sitecore/templates") > -1) && (_sName == "__Standard Values")) { } _sXmlNode = itemNode.OuterXml; }
public System.Xml.XmlNode Save(string xml, string databaseName, Credentials credentials) { object[] results = this.Invoke("Save", new object[] { xml, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void SaveAsync(string xml, string databaseName, Credentials credentials, object userState) { if ((this.SaveOperationCompleted == null)) { this.SaveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSaveOperationCompleted); } this.InvokeAsync("Save", new object[] { xml, databaseName, credentials}, this.SaveOperationCompleted, userState); }
/// <remarks/> public void RemoveVersionAsync(string id, string language, string version, string databaseName, Credentials credentials, object userState) { if ((this.RemoveVersionOperationCompleted == null)) { this.RemoveVersionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveVersionOperationCompleted); } this.InvokeAsync("RemoveVersion", new object[] { id, language, version, databaseName, credentials}, this.RemoveVersionOperationCompleted, userState); }
/// <remarks/> public void RenameAsync(string id, string newName, string databaseName, Credentials credentials) { this.RenameAsync(id, newName, databaseName, credentials, null); }
public System.Xml.XmlNode GetXML(string id, bool deep, string databaseName, Credentials credentials) { object[] results = this.Invoke("GetXML", new object[] { id, deep, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void GetXMLAsync(string id, bool deep, string databaseName, Credentials credentials) { this.GetXMLAsync(id, deep, databaseName, credentials, null); }
public System.Xml.XmlNode GetTemplates(string databaseName, Credentials credentials) { object[] results = this.Invoke("GetTemplates", new object[] { databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void GetTemplatesAsync(string databaseName, Credentials credentials) { this.GetTemplatesAsync(databaseName, credentials, null); }
/// <remarks/> public void GetMastersAsync(string databaseName, Credentials credentials) { this.GetMastersAsync(databaseName, credentials, null); }
/// <remarks/> public void GetLanguagesAsync(string databaseName, Credentials credentials, object userState) { if ((this.GetLanguagesOperationCompleted == null)) { this.GetLanguagesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetLanguagesOperationCompleted); } this.InvokeAsync("GetLanguages", new object[] { databaseName, credentials}, this.GetLanguagesOperationCompleted, userState); }
/// <remarks/> public void GetLanguagesAsync(string databaseName, Credentials credentials) { this.GetLanguagesAsync(databaseName, credentials, null); }
public System.Xml.XmlNode RemoveVersion(string id, string language, string version, string databaseName, Credentials credentials) { object[] results = this.Invoke("RemoveVersion", new object[] { id, language, version, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void GetXMLAsync(string id, bool deep, string databaseName, Credentials credentials, object userState) { if ((this.GetXMLOperationCompleted == null)) { this.GetXMLOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetXMLOperationCompleted); } this.InvokeAsync("GetXML", new object[] { id, deep, databaseName, credentials}, this.GetXMLOperationCompleted, userState); }
/// <remarks/> public void RemoveVersionAsync(string id, string language, string version, string databaseName, Credentials credentials) { this.RemoveVersionAsync(id, language, version, databaseName, credentials, null); }
public System.Xml.XmlNode InsertXML(string id, string xml, bool changeIDs, string databaseName, Credentials credentials) { object[] results = this.Invoke("InsertXML", new object[] { id, xml, changeIDs, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
public System.Xml.XmlNode Rename(string id, string newName, string databaseName, Credentials credentials) { object[] results = this.Invoke("Rename", new object[] { id, newName, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void InsertXMLAsync(string id, string xml, bool changeIDs, string databaseName, Credentials credentials) { this.InsertXMLAsync(id, xml, changeIDs, databaseName, credentials, null); }
/// <remarks/> public void RenameAsync(string id, string newName, string databaseName, Credentials credentials, object userState) { if ((this.RenameOperationCompleted == null)) { this.RenameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRenameOperationCompleted); } this.InvokeAsync("Rename", new object[] { id, newName, databaseName, credentials}, this.RenameOperationCompleted, userState); }
/// <remarks/> public void InsertXMLAsync(string id, string xml, bool changeIDs, string databaseName, Credentials credentials, object userState) { if ((this.InsertXMLOperationCompleted == null)) { this.InsertXMLOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInsertXMLOperationCompleted); } this.InvokeAsync("InsertXML", new object[] { id, xml, changeIDs, databaseName, credentials}, this.InsertXMLOperationCompleted, userState); }
/// <remarks/> public void SaveAsync(string xml, string databaseName, Credentials credentials) { this.SaveAsync(xml, databaseName, credentials, null); }
public System.Xml.XmlNode MoveTo(string id, string newParent, string databaseName, Credentials credentials) { object[] results = this.Invoke("MoveTo", new object[] { id, newParent, databaseName, credentials}); return ((System.Xml.XmlNode)(results[0])); }
public System.Xml.XmlNode VerifyCredentials(Credentials credentials) { object[] results = this.Invoke("VerifyCredentials", new object[] { credentials}); return ((System.Xml.XmlNode)(results[0])); }
/// <remarks/> public void MoveToAsync(string id, string newParent, string databaseName, Credentials credentials) { this.MoveToAsync(id, newParent, databaseName, credentials, null); }
/// <remarks/> public void VerifyCredentialsAsync(Credentials credentials, object userState) { if ((this.VerifyCredentialsOperationCompleted == null)) { this.VerifyCredentialsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVerifyCredentialsOperationCompleted); } this.InvokeAsync("VerifyCredentials", new object[] { credentials}, this.VerifyCredentialsOperationCompleted, userState); }
/// <remarks/> public void MoveToAsync(string id, string newParent, string databaseName, Credentials credentials, object userState) { if ((this.MoveToOperationCompleted == null)) { this.MoveToOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMoveToOperationCompleted); } this.InvokeAsync("MoveTo", new object[] { id, newParent, databaseName, credentials}, this.MoveToOperationCompleted, userState); }
public void SetAPIConnection(Sitecore5x.VisualSitecoreService sitecoreApi, Sitecore5x.Credentials credentials) { _sitecoreApi = sitecoreApi; _credentials = credentials; }
/// <remarks/> public void GetItemFieldsAsync(string id, string language, string version, bool allFields, string databaseName, Credentials credentials) { this.GetItemFieldsAsync(id, language, version, allFields, databaseName, credentials, null); }