Lists.UpdateListItems with External List

Dec 11, 2012 at 4:18 PM

Hi Guys,

i find this Library really usefull! Makes Frontend Development on SharePoint fun. Thank you for that.

But now i found something strange. I want to add a new Item to an External List (BCS) but i allways get the Error: 

<ErrorCode>0x80070057</ErrorCode><ErrorText>Bad parameter passed to Web Server Extensions. Check the information you entered and try again.

The code i use: 

 $().SPServices({
            operation: 'UpdateListItems',
            async: true,
            batchCmd: "New",
            listName: 'Rating',
            valuepairs: [["MediaID", self.currentMediaID],
                ["ProductID", self.currentProductGroup().id],
                ["GroupID", self.currentMediaGroup().id],
                ["Trademark", self.getTrademark()],
                ["Ranking", self.currentRating()]],
            completefunc: function (xData, Status) {
                self.getRatings(); 
                self.waiting.remove();
            }
        });

ListDefinition: 

     <ViewFields xmlns="http://schemas.microsoft.com/sharepoint/soap/">
          <FieldRef Name="BdcIdentity" StaticName="BdcIdentity" DisplayName="BDC Identity" Type="Text" />
          <FieldRef Name="ID" StaticName="ID" DisplayName="ID" Type="Text" />
          <FieldRef Name="GroupID" StaticName="GroupID" DisplayName="GroupID" Type="Text" />
          <FieldRef Name="ProductID" StaticName="ProductID" DisplayName="ProductID" Type="Text" />
          <FieldRef Name="MediaID" StaticName="MediaID" DisplayName="MediaID" Type="Text" />
          <FieldRef Name="Ranking" StaticName="Ranking" DisplayName="Ranking" Type="Number" />
          <FieldRef Name="GroupName" StaticName="GroupName" DisplayName="GroupName" Type="Text" />
          <FieldRef Name="ProductName" StaticName="ProductName" DisplayName="ProductName" Type="Text" />
          <FieldRef Name="Trademark" StaticName="Trademark" DisplayName="Trademark" Type="Text" />
     </ViewFields>

 

Did i missed something? Anybody knows what could be the matter? 

 

Thank You in advance!

 

Rafael

Dec 17, 2012 at 10:41 AM

This is something I have never been able to do with web services. I tried every trick I could think of! I even tried to write the SOAP request manually including the name of the command from BCS to no avail. I have heard some people may have had success adding an item but never updating one. I had to use the javascript client-side object model code (CSOM) to do this and this works fine. I still use SPServices for most everything else. There are plenty of examples on doing this in JSOM/CSOM out there.

Dec 17, 2012 at 3:43 PM
Edited Dec 17, 2012 at 3:45 PM

A good link to read over:

http://allthatjs.com/2012/07/17/api-access-to-sharepoint-external-list/

The meat and potatoes of this post is this:

External list CRUD Operations

SharePoint API Read Create/Update/Delete
ListData.svc (REST) Not supported Not supported
Web services (SOAP) Supported (GetListItems) Not supported
Client side object model Supported Supported

 

Cheers,
Matthew