manuelityo

Hello:

I'm trying to upload a file in a Document Library using the List.asmx Web Services of SharePoint and the AddAttachment method, who requires of 4 parameters. The problem that I'm having is that when I pass the parameters I obtain an "Microsoft.SharePoint.SoapServer.SoapServerException" type error, "The value is not in the expected interval" ("Value does not fall within the expected range", sorry for the translation). I suppose that the point is "List Item ID" parameter, but Im not shure.

try

{

// AddAttachment(string listName, string listItemID, string fileName, byte[] attachment)

string AddAttach = listService.AddAttachment("Document shared", "3", FileUp.FileName, FileUp.FileBytes);

Response.Write(AddAttach );

{

catch (System.Web.Services.Protocols.SoapException ex)

{

Response.Write(ex.Message);

}

It is makes me crazy, I have tryed with all te possibles values, but it doesn't work!

If somebody could help me with your expirience and knowledge I really apretiate it.



Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

qs

I am also getting this error, did you find a solution for it.



Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

slink

I also get the problem.

Tried also the image service , but the image service wants images.

I think this might be a bug, because several people seem to have exactly the same problem.

If this does not work, I will have to write a custom webservice to do the document upload.

Creation of the List Entry works fine, but AddAttachment fails.

But :

If the list is of type Userdefined List the AddAttachment function works fine.

It s possible to add attachments to list items.

So what is missing is a correct sample or documentation what to do with different List types, especially document Libraries.





Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

manuelityo

Hello:

Have you add an attachment in a CustomList type List

Could you please tell us the value of the listItemId parameter

Thanks in advice





Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

Rocco Mastrangelo

Hi,

Add me to the list of folks getting this same error. For listItemID, I parse the ows_ID value returned from a call to UpdateListItems which first creates the list item. I then call AddAttachment using this value to add the attachment to the list item I just created.

Can someone from Microsoft (or anyone else for that matter) shed some light on this please

Much thanks.





Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

Robert Gruen

Lists.AddAttachment() only works for Custom Lists and not Document Libraries. If you want to add

a document to a document library you have to use the [local] object model. If you want to expose that to a different machine, you'll have to create your own wrapper web service.

I found out the hard way just like you folks but confirmed it with my MOSS contacts.

Thanks!

Rob






Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

manuelityo

Is sad to know that and shameful (for Microsoft)

Thnx for your help





Re: SharePoint - Development and Programming WebServices SoapServerException to Upload with AddAttachment

sinceresiva

Even I couldn't get a satisfactory answer to what is going to be listItemID etc of the AddAttachment() method. Finally I had to settle down to good old HTTP PUT. This article is what I am going through right now. I hope it helps u too. Have a look..

http://www.topxml.com/rbnews/XmlDocument/re-60127_Uploading-files-to-WSS-3-0-document-libraries-using-HTTP-PUT-and-Lists-asmx.aspx

Regards,

sinceresiva