Tag Info

Hot answers tagged

15

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 ...


5

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") ...


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

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 ...


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

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

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

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 ...


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

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

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

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

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

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

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. ...


1

I agree with Andreas - you don't have to call Update() or SystemUpdate(). We have code in production that changes permissions and doesn't call Upate afterwards. But almost every example on the internet calls Update() after changing the role assignments. Here's one blog post that doesn't call it: ...


1

You can take one more column in Public List to put the ID of the Admin List item, a kind of a key... And when "assessment complete" or "yes" status occurs to Public List item, you can get the Admin List Item from the Id and update it instead of copying/adding new item in Admin List... You can make this column a Lookup column for easy handling, and hide this ...


1

Same issue i faced recently, but resolved with lot of research. The above mentioned issue will come duplicate columns exist in your List schema file. verify your List schema once.... Still the problem exist, follow the below trick verify your "ColName" attribute for every Field, it should be UNIQUE for every Field. because Colname attribute defines the ...


1

I strongly recommend u start by monitoring menuItems with a debugger, since this is your global variable that stores the Items. At the end you could write some code like this: function saveChanges() { var context = new SP.ClientContext.get_current(); var web = context.get_web(); var list = web.get_lists().getByTitle("ExpenseReportItems"); ...


1

For example, it's not safe to make updates and removal on GET requests, because someone may send you a link, you will click and item will be deleted. Thus it's strongly recommended to make updates on POST requests, thus the error is fired. In some cases it's really required to do and AllowUnsafeUpdates is used. Please see this link and that link for ...


1

I would suggest reviewing Karine Bosch's blog posts series on SharePoint Event Receivers that includes simple Walkthroughs with Document Library Event Receivers.


1

please pay attention to the Task List. The Task lists execute the Workflow really. If you don't finalize the assigned task, your WF not run. This is my code to exceute a task and make te WF continue by the steps: This code it's used ina SP WebPart, with a WorkFlow with two approvers.: SPSecurity.RunWithElevatedPrivileges(delegate() { ...


1

If you want to update a listitem or start a workflow without server side code, then in SP2007 you only option is to use the Web Services. If you want to do it directly in javascript on a form I'd recommend that you use SPServices, which is a jQuery library for SharePoint, that amonst other allow you to update a list item or start a workflow


1

When you modify a list template, the changes are only visible in new list instances you create after the modification. This is by-design. Unfortunately you need to manually modify existing list instances, or create a small application that will loop through all SPWebs and lists on each site, and modify the choices.


1

For the following examples I've created: a site called MySubSite in my sitecollection http://sharepoint. a document library called "My Doc Lib" added a column "FirstName" a folder called "My Folder" uploaded a document called mydoc.txt to both the root and "My folder" The following code finds the mydoc.txt inside "My folder" and changes FirstName. ...



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