Monday, November 15, 2010

Update List Column Programmatically for SharePoint 2007

Two ways of doing this:

First one is via SharePoint object model:


SPList oList = oWeb.Lists["Technical"];
SPField myField = oList.Fields["Sub-tag"];
String schema = " xx ";
myField.SchemaXml = schema;
myField.Update();


the Second way is via Lists.asmx web service:

XmlNode listNode = mylistsrv.GetList("Technical");
string version = listNode.Attributes["Version"].Value;
string guid = listNode.Attributes["Name"].Value;

XmlDocument xmlDoc = new XmlDocument();
XmlElement updateFields = xmlDoc.CreateElement("Fields");

string fieldXml = "";

updateFields.InnerXml = fieldXml;
XmlNode result = mylistsrv.UpdateList(guid, null, null, updateFields, null, version);

Disable Microsoft Defender for Cloud for Visual Studio Subscription (MSDN)

I use a visual studio pro subscription which comes with $150 azure cloud credit, for some reason Microsoft Defender for Cloud was turned on ...