This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void AddChangeRequestFields(string strDocToRefer, string strUserFQN, string strMode) | |
{ | |
SPSite siteCollection = null; | |
SPWeb topLevelSite = null; | |
string[] arrXRefDocs; | |
string strNewXRef = String.Empty; | |
siteCollection = new SPSite(System.Configuration.ConfigurationManager.AppSettings["SPDocumentLibrary"].ToString()); | |
topLevelSite = siteCollection.AllWebs[ConfigurationSettings.AppSettings["TopLevelSite"].ToString()]; | |
topLevelSite.AllowUnsafeUpdates = true; | |
SPList list = topLevelSite.Lists["Approved Documents"]; | |
foreach (SPListItem item in list.Items) | |
{ | |
if (strDocToRefer.Equals(Convert.ToString(item["Document Number"]))) | |
{ | |
if (strMode.Equals("Add")) | |
{ | |
item["Initiate Change Request"] = ""; | |
item["CR Initiated By"] = strUserFQN; | |
} | |
else | |
{ | |
item["Initiate Change Request"] = System.Configuration.ConfigurationManager.AppSettings["SPDocumentLibrary"].ToString() + "?ID=" + strDocToRefer.Trim() + "&Type=CR"; | |
item["CR Initiated By"] = strUserFQN; | |
} | |
item.Update(); | |
break; | |
} | |
} | |
topLevelSite.AllowUnsafeUpdates = false; | |
siteCollection.Dispose(); | |
topLevelSite.Dispose(); | |
} |