Add item with content type Document/Link to a document

Nov 30, 2010 at 2:03 PM

Hello,

First of all thanx alot for providing such great library, it has been a wonderful experience.

I've been trying to add an item to a document library that has Document/Link to a Document content types, every time the item gets added to the document library just like the code below shows; the item Title gets replaced with an ID(number) and an underscore, any idea why ?


$().SPServices({
        operation: "UpdateListItems",
        async: false,
        listName: "Mash Library",
        updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
                "<Method ID='1' Cmd='New'>" +
                    "<Field Name='Title'>Google</Field>" +
                    "<Field Name='URL'>http://google.com</Field>" +
                "</Method>" +
            "</Batch>",
        completefunc: function(xData, Status) {
            alert(Status);
        }
});

Zafer

Coordinator
Dec 1, 2010 at 3:39 PM

Zafer:

Yup, I can reproduce this. You're trying to create an item in a Document Library that doesn't have a document. This is undoubtedly the issue.

M.

Dec 2, 2010 at 10:25 AM

Marc:

Thanx alot for replying,

Sorry but maybe i got it all wrong; as far as i know a link to a document content type has only two fields a Title and a URL, so how come it needs a document !

And I made sure that the default content type for that library was 'a link to a document' not a 'document' content type.

Zafer 

Coordinator
Dec 2, 2010 at 12:14 PM

Document Libraries exist to contain documents. The first thing you do when you create a new item is to upload the document; then you set the metadata.

Perhaps you should be using a Custom List?

M.