Tag Info

Hot answers tagged

19

The two items are not really related. AllowUnsafeUpdates will allow changes to the content database happen on a GET request instead of a POST request. This is a very bad idea. It is very trivial to write a script to perform 1000s of GET requests per minute, which would update your content database with duplicates. The actual use cases for AllowUnSafeUpdates ...


7

You use SPSecurity.RunWithElevatedPrivileges when you have a piece of code which requires higher privileges than currently logged in user. For example, your code wants to check if current user belongs to "Approvers" group and Approvers group is configured such that only members of Approvers group can see the membership. You will need ...


6

I anticipate that your root list has the same event receiver assigned to it, and that causes the recursion. The problem, of course, may be not so obvious, but anyway, to prevent event receiver to fire several times, there is a common practice in SharePoint: just use DisableEventFiring and EnableEventFiring methods. internal void ...


6

Update list item using powershell - $SPAssignment = Start-SPAssignment $SPWeb = Get-SPWeb http://SP -AssignmentCollection $spAssignment Next step is to get the list: $SPList = $SPWeb.Lists["Announcements"] When we have located the list we can retrieve the item. The quickest way is to use the GetItemByID() method: $SPItem = $SPList.GetItemById("1") ...


5

The two are totally different things as explained here: AllowUnsafeUpdates vs RunWithElevatedPrivileges http://rameshsps2010.blogspot.co.uk/2011/06/allowunsafeupdates-vs.html AllowUnsafeUpdates Gets or sets a Boolean value that specifies whether to allow updates to the contents database as a result of a GET request or without requiring a security ...


5

If you only use this for display purposes, why not use a different approach which does not require you to do updates on the list item at all.... Create the site column in a sandboxed solution. Your column stores the Due date. Create a javascript file to deploy somewhere to your site, e.g. /Documents/duedate.js Configure the JSLink property in the site ...


4

Not sure I would use PowerShell for this. Why not use Business Connectivity Service (SP2010) or Business Data Catalog (SP2007) for this? If you need to move data redundantly into a list in SharePoint with certain intervals another option would be SQL Integration Services.


3

I still think that it should be timerJob; you can add "Processing Status" field to master list to track job progress and use tight schedule, but it will definitely work better than attempt to use async event receiver. just my opinion


3

You have to "roll your own check". User GetListItems to see if there is an existing item and then conditionally either add a new item or update the existing one.


3

The problem is that you are using a filepath that is URL encoded (the %20 should be a space): <Batch OnError="Continue"> <Method ID="1" Cmd="Update"> <Field Name="ID" /> <Field Name="FileRef">http://sharepoint:32667/personal/user/Shared Documents/EmailMessage.msg</Field> <Field ...


3

OK, SO I think I solved my problem. I actually had two things going on here: 1) A WCF connection propagates metadata updates on check-in to another web application (ASP.NET). The field I was constantly getting messages about IS required on that site. Wouldn't expect anyone on here to figure that out. I made the field required in SharePoint and set ...


3

First thing first, Yes you will have to call listItem.Update() reason is because in itemAdded event Item has been added to list already and now you are about to update it. Second, as Paul said you setting item level permissions can be nightmare as they actually effect page's performance while loading it. Third, you might would like to look at this article, ...


3

This turned out to be unrelated to the XML or privileges. The URL I used to hit lists.asmx on the production site was pointing to the root of the site instead of to the web where my list is. So I was using http://mysite/_vti_bin/lists.asmx when I should have used http://mysite/web1/web2/_vti_bin/lists.asmx


3

What is happening is that your event receiver is kicking in before your PowerShell is done, and modifying it on a different thread before your PowerShell update occurs. When SharePoint hits your update statement, it sees that the item in the database is no longer the same as the one it's trying to update. I've got 3 different approaches: Set all of your ...


3

If you are updating a list item more than once in succession, after the first update the list item (oListItem in your case) object will have become stale, and the server will reject the update. SharePoint uses a hidden field called owshiddenversion, which gets downloaded along with your CSOM object, to determine which version you are editing. When you send ...


3

Change NULL to null. I tried the following - first test resulted in a 400 Bad Request error, the second one worked fine. {'__metadata': { 'type': 'SP.Data.TasksListItem' },'StartDate': NULL} {'__metadata': { 'type': 'SP.Data.TasksListItem' },'StartDate': null}


3

Try the following script: $web = Get-SPWeb http://YourServer/ListLocation $list = $web.Lists["TheList"] foreach ($item in $list.Items) { if( $list.Fields.ContainsField("ddlTest") -eq $true) { $item["Number"] = Get-Random -Min 0 -Max 100; $item.Update(); } }


3

Since you don't need to use the SPServices library, you can accomplish this via REST and the moveTo() method. The following should work: var url = "/_api/Web/Lists/getByTitle('My List Name')/Items", qs = "?$filter=Attachments eq 1&$select=ID,Author/Title,*&$expand=Author"; $.ajax( { url : siteUrl + url + qs, type : 'GET', headers : { ...


2

Here is the final version. I had to use SP Manager to get the guid of the term set. I am sure I can add more logic to PS script and look for actual term. But for now this works... I updated the code with the working code in the original post.


2

Given the information I would still chose to do a console app that leverages SharePoint's web services versus using PowerShell with remoting. If you need it to work with both, then I would stick with the soap based services. http://msdn.microsoft.com/en-us/library/ms479390(v=office.12).aspx


2

This could be a case where the handle to the list is recreated with each call which would explain why the changes are not persisting. Try this instead : SPList pagesList = publishingWeb.PagesList; pagesList.EnableModeration = false; pagesList.EnableVersioning = true; pagesList.MajorVersionLimit = 10; pagesList.EnableMinorVersions = false; ...


2

If your data source is within a site collection, use a Content Query Web Part and filter on the Task content type, or otherwise use SPSiteDataQuery. If it's split across site collections, you can only use search, and the indexing can only occur on a content source, as Anita mentioned.


2

It isn't possible to update the searchindex for just one item. An incremental crawl is necessary to update the index. Maybe it's possible to build the webpart not using the searchindex?


2

You have to roll your own, there isn't anything built in. The closest is a form operation, SPRequireUnique. You'd need to do a GetListItems operation to first see what's in the list, compare it to what you have and either skip it, update it, or add it.


2

mikey, This is not available OOB... What you can do is create a new Custom Action that will add a button to the ribbon right after the Edit button, follow this on making custom action: http://msdn.microsoft.com/en-us/library/hh500259.aspx In custom action, call a Javascript function in which you can get all the items selected by user, see this URL: ...


2

Event receivers are generally attached to lists by means of a list definition (which can define event receivers that are attached upon deployment) or programmatically through custom code. Depending on how you're deploying this event receiver, you might not actually be attaching the receiver to your list. You can use PowerShell to see which event receivers ...


2

You can use SPItemEventReceiver to create your own event receiver. In your receiver you can implement ItemUpdating method. In this method you can retrieve item from SPItemEventProperties. Compare item field value with your value and use following code to cancel update: properties.Cancel = true; properties.ErrorMessage = "you can not update this item";


2

This cannot be done with out of the box functionality, AFAIK. There is a free tool, called the HarePoint Workflow Scheduler. Once installed on the server, you can configure it to run on each item in a view. It can even work without views by providing the CAML query directly to the scheduler task. ...


2

I assume you have a customized page where these users enter the User's name and then you replace all instances of that name with a new one... To do this client side, you need to use the 'SearchPrincipals" webservice. It will return a list of possible matches based on a name/email/login name. You might also be interested in this client side People Picker ...


2

here is powershell script to list all properties and then how to change them. # Load SharePoint library [system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint") # Connect to the site collection http://SP2010 and store the object in the $site variable $site = New-Object Microsoft.SharePoint.SPSite("http://SP2010") # Connect to the root ...



Only top voted, non community-wiki answers of a minimum length are eligible