Delete using code - Find works & Delete does not

M

Marc Nemegeer

Hi,

I'm puzzled by a problem and I don't find a solution or a clue to solve it
....

I have set up a sharepoint services, created an Infopath form that submits
to a forms library. Now, I want to delete a document in code.

I'm using httpWebRequest to implement it. It works fine for a FIND, a DELETE
does only work on my development environment (virtual pc, W2003, Infopath,
etc.)

Any clues for where to start looking ??

Thanks,
Marc
 
J

JR

Are you using managed or unmanaged code? From my understanding (and I could be wrong about this part, so please feel free to correct me) if you are using managed code, your form will need to be digitally signed so it can be fully trusted. Without full trust, you may not be able to delete the file.

We are currently using unmanaged code to delete a form from the library and it works fine with the form security set to "Automatically determine security level..." which is translating into Domain level security when we publish the form.

Here's the snippet of jscript code, in case it helps..

==============================
// create an xmlhttp object.
var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");

// does the file already exist - returns 200/201 if found, 404 if not
oXmlHttp.Open("HEAD", libraryUrl, false);
oXmlHttp.Send();

// document already exists, delete it
if (oXmlHttp.Status == 200 || oXmlHttp.Status == 201)
{
oXmlHttp.Open("DELETE", libraryUrl, false);
oXmlHttp.Send();
}
==============================

Of course, you will probably want to wrap this in a try, catch..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top