Tag Info

New answers tagged

-1

In the code you have written a for loop which is looping all the items in the list. So for every item it is updating the column value until it reaches the last list item count. Use properties.ListItem to update the current item in which you have ItemAdding event will fire.


1

You can modify item properties, except ID like this. public override void ItemAdding(SPItemEventProperties properties) { string mycol_internal = ""; using (SPWeb web = properties.OpenWeb()) { mycol_internal = web.Lists[properties.ListId].Fields["My Column"].InternalName; } properties.AfterProperties[mycol_internal] = "your new ...


2

Avoid using SPContext inside receiver. SPContext doesn't exist in a feature receiver. Instead use the Properties object as it includes a reference to the site or web use following public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWeb web = properties.Feature.Parent as SPWeb; using (SPSite site = new ...


0

Try public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = SPContext.Current.Site) { using (SPWeb myweb = site.OpenWeb()) { SPList list = myweb.Lists.TryGetList("Document Library"); ...


2

Because you do not Change the value in the field, you just Change the value in your variable. you have to item[fieldID] = "";


3

Explanation Based on your affirmative response to my comment, I've gone ahead and wrote this using the JSOM API. The script works by disabling the ReadOnly property on the RichMessage field, updating the values on your target item, and re-enabling the ReadOnly field. Up until now, this is the only working strategy I've found to change read-only fields from ...


-1

be sure that you include that field in the viewfields


1

What you want to do is use the Feature Upgrade mechanism to add the columns to the already existing list. If you just re-deploy the feature without "upgrading", then yes, the existing list will be overwritten with a new, blank list. Here is some documentation on MSDN about Feature Upgrades. Here is a series of blog posts by Chris O'Brien about Feature ...


0

First find your way to Navigation Settings – start with Site settings > Look and feel > Navigation > Global Navigation setting. Use Radio button to enable the site to use its own Top Link bar and not inherit it from parent site. Then tick the check box for SharePoint Server 2010 to automatically display the new pages in the site


0

Try below code : I think it should be better in performance wise $web = Get-SPWeb http://portal.sharepoint.com $list = $web.Lists["LargeList"] $view = $list["your view name"] $spQuery = New-Object Microsoft.SharePoint.SPQuery($view) do { $listItems = $list.GetItems($spQuery) $spQuery.ListItemCollectionPosition = ...


0

You can use SPQuery in Powershell if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } $web = Get-SPWeb http://myweb/ $list = $web.Lists["MyList"] $spQuery = New-Object Microsoft.SharePoint.SPQuery $spQuery.Query = $list.Views["ViewName"].Query $items = ...


0

Try the below code: SPSite site = new SPSite("http://simosi.com"); SPWeb web = site.RootWeb; SPList lst = web.Lists.TryGetList("Tasks"); if (lst != null) { SPQuery q = new SPQuery(); q.Query = lst.Views["ActiveTask"].Query; SPListItemCollection items =lst.GetItems(q); ...



Top 50 recent answers are included