UpdateList - Input In Wrong Format

Nov 18, 2010 at 1:36 PM

I'm trying to use the UpdateList function to create the columns of a custom list I've made.

$().SPServices({
	operation: "UpdateList",
	listName: "TheList",
	listProperties: '<List Title="TheList" Description="The List" />',
	newFields: fields,
	updateFields: '',
	deleteFields: '',
	listVersion: '1.0',
	completefunc: function(xData, Status) {
		if(Status == "success") {
			$('#create-schema-status').html("Done.");
		} else {
			$('#create-schema-status').html("Failed.");
		}															
	}
});
Where the 'fields' variable is something like:
<Fields>
	<Method ID="1"><Field Type="Counter" Name="ID" DisplayName="ID" FromBaseType="TRUE" ReadOnly="TRUE" PrimaryKey="TRUE" /></Method>
</Fields>

But, I keep getting this error message 

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Input string was not in a correct format.</errorstring></detail></soap:Fault></soap:Body></soap:Envelope>
The heart of it is "Input string was not in a correct format."
Any idea what is wrong with my field def?  Or is it something else in the operation call?  Do I have to use the list GUID when making this call or can I use the display name?
Also, on a side note, can I just leave the listProperties option blank, '', or do I have to put in the obligatory information even if I don't want to change it?
Thanks.


Coordinator
Nov 22, 2010 at 3:36 AM

chadsowald:

Sorry for the delay in getting back to you.

You can't create the ID column, as it's a SharePoint-managed column created with every list. Try creating a simple, new 'Single line of text' column first.

The errors that the Web Services give you can be pretty darn cryptic, so the best practice based on my expereince is to take very small baby steps until you get familiar with the operation you need. Once it works for you in a predictable way, start adding in more bits and pieces to accomplish your actual objective.

Hope this helps. Let me know how it goes...

M.

Nov 22, 2010 at 9:05 AM
Hi and thanks for your help. It turned out it wasn't the newFields or the listProperties attributes that were messing it up, but instead the version parameter. I set it to empty, '', and everything worked. I'm not really sure what it was expecting and being as the error message was so cryptic, I don't know what it didn't like. Thanks again.


On Mon, Nov 22, 2010 at 4:36 AM, sympmarc <notifications@codeplex.com> wrote:

From: sympmarc

chadsowald:

Sorry for the delay in getting back to you.

You can't create the ID column, as it's a SharePoint-managed column created with every list. Try creating a simple, new 'Single line of text' column first.

The errors that the Web Services give you can be pretty darn cryptic, so the best practice based on my expereince is to take very small baby steps until you get familiar with the operation you need. Once it works for you in a predictable way, start adding in more bits and pieces to accomplish your actual objective.

Hope this helps. Let me know how it goes...

M.

Read the full discussion online.

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

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

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe 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


Coordinator
Nov 23, 2010 at 3:47 AM

Aha! I didn't spot that. Glad you worked it out.

M.