Reputation: 85056
I've been looking at using the Administration Object Model but it doesn't seem to get into this.
Can anyone recommend tutorials or point me in the right direction to get this going?
Upvotes: 2
Views: 7889
Reputation: 85056
I was finally able to do this by using the SPListItem.Update() method.
Example:
SPSite site = new SPSite("http://mySPSite/");
SPList oList = site.AllWebs["Main"].Lists["Documents"];
SPQuery oQuery = new SPQuery();
oQuery.Query = @"<Query><Where><Eq><FieldRef Name='Published' /><Value Type='Text'>0</Value></Eq></Where></Query>";
SPListItemCollection collListItems = oList.GetItems(oQuery);
foreach (SPListItem oListItem in collListItems)
{
oListItem["Published"] = 1; //These two lines will do the update. In this case I am updating Published to 1
oListItem.Update();
}
Upvotes: 1
Reputation: 1306
If you are referring to Managed Metadata (a new feature of SharePoint 2010), this could be your gateway: http://msdn.microsoft.com/en-us/library/ee556337.aspx.
The term "Metadata" is also used for any custom attributes you want to specify to items (or documents) in SharePoint environment. Usually such metadata is logically aggregated into a SharePoint construct called Content Type which is attached to an SharePoint item (or a document in SharePoint Library).
If you are programmatically create document in document library and also set the metadata for the document, this link may help: http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
If it is not a document library but a custom list (with specific content type attached to it), you may find plenty of resources on google when you type "Add List Items to the Sharepoint List Programmatically"
If you are new to SharePoint, I understand it is quite a learning curve for you. After working with Microsoft Technologies for years, I think being a Proficient SharePoint Developer involves longest learning curve even if you are a seasoned C# developer.
Upvotes: 1
Reputation: 473
Hi Ashish Patel Take a look to the following article if you are talking about metadata in sharepoint 2010
Managed Metadata in SharePoint 2010 – a key ECM enhancement
Regards,
Upvotes: -1