addItem ID must be provided and is bulk add possible? [Resolved]

Mar 2, 2010 at 4:23 AM

Just noticed in the docs here looks like it might be a copy of updateItem. If the info there is required, is there a recommended way to get the next available ID for a list when calling addItem? Does SharePoint automatically increment its internal index pointer so that I could just get the last item of a list and +1 to that for the next ID?

Ah I just looked at the source and addItem calls updateItem itself so that answers my questions on the necessity of an ID for each item... ah but wait... OK this is for the benefit of other newbie SharePoint folks like myself (if you all want me to I can help update minor documentation things if desired).

So in the source it actually checks for the presence of the ID. If you don't include an ID (or if the ID == 0) the CAML generated will be for a new item, but if the ID >= 1 it'll call an update for that ID.

There is still a security issue lingering for me. I know that the request is made in the security context of the currently logged in user. But if both User A and User B can create items on MyList, is there any way to keep User B from modifying User A's entries and vice versa? The only thing I can think of (and I think I mentioned this in another post) is to do a check server side but then I wouldn't be able to use jPoint's features for that.

Of course where ultimate security is not an issue, it's to do client side filtering to prevent that sort of thing. (Thinking out loud.)

Michael

Coordinator
Mar 2, 2010 at 5:55 AM

Hi Michael,

You are hitting all the right points. We would love help with some documentation, especially from perspective of someone starting up and picking jPoint for the first time.

To answer your question about security it is driven by SharePoint security. That is the beauty of it all. We are not really inventing the wheel in regards to the SharePoint, we are just letting developers have clientside options of accessing that data. As you can see addItem is just a updateItem with zero passed in as listID. Add item returns last added list item ID, so right after creation of new item you can use data to add more actions. Something like @@Identity in SQL. Also updateItem is an array of JSON objects, so you can update more then one list item with one call.

If user B has permission to modify user A's entry then s/he will be able to make changes just like in regular SharePoint rules. If user does not have persmission, updateItem webservice response will respond with error status message.

Mar 2, 2010 at 6:17 AM

Updating that bit of documentation isn't a problem. I'll write something up in a spare moment! :) Lot of learning going on right now. I have been looking for a SharePoint way to allow only list item creators (and admins) to have the rights to modify an item. I haven't found that yet though.

I hadn't noticed that addItem returns the last added ID actually. I'll look more into that tomorrow. Not having access to an actual relational database I am having to check how things are done in SharePoint.

Thanks!

Michael

Coordinator
Mar 2, 2010 at 7:05 AM
Michael,

If you send me an e-mail at will.lawrence [ a t ] sharejPoint.com, I can give you an account and password to allow you to update the documentation and become a contributing member to the open source jPoint project.  

With regards to your User B being prevented from modifying User A's items, look at a list or document setting's Advanced settings.  There are Read access and Edit access item-level permissions built into SharePoint (WSS v3, MOSS 2007, and above).  You can change Edit access to "Only their own".  So, unless you are an administrator with full control, User B cannot edit User A.  The SharePoint web service should adhere to the same security permission model as the web interface.  

Thanks for your inquiries.  I have been thinking that some of these exchanges would make for a good blog post.  Any objections?

-Will

On Tue, Mar 2, 2010 at 1:17 AM, michaelangela <notifications@codeplex.com> wrote:

From: michaelangela

Updating that bit of documentation isn't a problem. I'll write something up in a spare moment! :) Lot of learning going on right now. I have been looking for a SharePoint way to allow only list item creators (and admins) to have the rights to modify an item. I haven't found that yet though.

I hadn't noticed that addItem returns the last added ID actually. I'll look more into that tomorrow. Not having access to an actual relational database I am having to check how things are done in SharePoint.

Thanks!

Michael

Read the full discussion online.

To add a post to this discussion, reply to this email (jPoint@discussions.codeplex.com)

To start a new discussion for this project, email jPoint@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
William Lawrence
703-873-7035
Mar 2, 2010 at 5:01 PM

Email is off and away. Thanks!

I had read about the advanced options but there were apparently some issues with it which I must not have read correctly. I have been eating/sleeping SharePoint for a few days now.

And you may use any of my posts for blog content as I think it may help others coming in as well. I still have more questions that will be coming as well. :)

Michael

Coordinator
Mar 2, 2010 at 10:35 PM
Great, keep the questions coming.  I'm giving you access in just a few moments.  

On Tue, Mar 2, 2010 at 12:01 PM, michaelangela <notifications@codeplex.com> wrote:

From: michaelangela

Email is off and away. Thanks!

I had read about the advanced options but there were apparently some issues with it which I must not have read correctly. I have been eating/sleeping SharePoint for a few days now.

And you may use any of my posts for blog content as I think it may help others coming in as well. I still have more questions that will be coming as well. :)

Michael

Read the full discussion online.

To add a post to this discussion, reply to this email (jPoint@discussions.codeplex.com)

To start a new discussion for this project, email jPoint@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
William Lawrence
703-873-7035
Coordinator
Mar 3, 2010 at 6:32 PM

Bulk add is possible, but returning list ID will be last item added.