Custom ECB helped by SPServices

May 7, 2010 at 9:37 PM

I had a requirement to implement item level security on a list and I also had to add a lot of functions or actions to the items as well. I decided to create a custom Edit Control Block that uses a .aspx page to create a list of commands for the item based on the users permissions on that item. One of the functions I have added is a repeat function that allows the user to basically copy the item to a new item while assigning it to a different department, division, subdivision. The menu cascades out from one item with a list of all departments and then continues out for the divisions and subdivisions. I needed to find a way to check the selected option to be sure that the item had not already been assigned to the selected option. I used SPServices again to accomplish that check which works really well. Now I just need an easy way to copy the item and update a few fields and that whole function will be done!

Coordinator
May 8, 2010 at 4:53 AM
Edited May 8, 2010 at 4:54 AM

Daniel:

Cool stuff, as always.

Copying the item is actually pretty straightforward. Just do a GetListItem to grab the existing item, parse out the values you want, and then use UpdatelistItems to write the new item.

M.

May 8, 2010 at 9:36 AM

Funny that was what I was thinking about doing. By the way, do you know if an item event receiver still fires if items are added using webservices? I have to still do this with item level security so I am using event receivers for that. 

Looking forward to Sharepoint Saturday DC!

Coordinator
May 8, 2010 at 12:51 PM

AFAIK, all the normal events are going to be triggered.  You're creating a real item, and the method you're using to do it doesn't make a whit of difference.

You can set permissions with the Web Services, too, if you don't want to mess with event receivers.

M.

May 9, 2010 at 12:52 AM

The repeated item will most likely need the same permissions as the one it was repeated from. It would be nice to just copy the item to a new item with only the one field changed and carry the permissions with it. Thanks for the info! I will look at how to do it with webservices!