Monday, May 28, 2012

Property or indexer 'Microsoft.SharePoint.SPListItem.Title' cannot be assigned to -- it is read only


Property or indexer 'Microsoft.SharePoint.SPListItem.Title' cannot be assigned to -- it is read only :-



 protected void btn1_Click(object sender, EventArgs e)
        {
            using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Announcements"];
                    SPListItem item = list.AddItem();
                    item["Title"] = "New Announcement";
                    item.Update();
                }
            }
        }


No comments:

Post a Comment

Featured Post

Develop Azure AI services applications with Azure Key Vault - Language service

Develop Azure AI services applications with Azure Key Vault: https://learn.microsoft.com/en-us/azure/ai-services/use-key-vault?tabs=azure-cl...

Popular posts