<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Services</title><link>https://www.infopathdev.com:443/forums/48.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Odd behavior</title><link>https://www.infopathdev.com:443/forums/thread/17512.aspx</link><pubDate>Fri, 20 Jan 2006 03:18:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17512</guid><dc:creator>delu</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17512.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=48&amp;PostID=17512</wfw:commentRss><description>Hi there!&lt;br /&gt;&lt;br /&gt;I created a web service with two methods:&lt;br /&gt;one for checking out a document and one for deleting a document.&lt;br /&gt;I tried both methods with a test Windows form application and they work fine.&lt;br /&gt;&lt;br /&gt;I published the form with full trust and a certificate, so the security should be fine.&lt;br /&gt;&lt;br /&gt;However, when I call them from managed code within the infopath document (in exactly the same way), the checking out method always reports/throws an exception that the file is already checked out. The delete method deletes the document, however, when I want to submit the document again, I get an error message that I can not overwrite the file (I don't want to give that permission to the submit data-connection).&lt;br /&gt;&lt;br /&gt;The methods look like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public string DeleteDocument(string page, string folder, string file)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        SPSite site = new SPSite(page);&lt;br /&gt;        SPWeb web = site.OpenWeb();&lt;br /&gt;               &lt;br /&gt;        SPFileCollection delFiles =    &lt;br /&gt;         web.Folders[folder].Files;&lt;br /&gt;        delFiles.Delete(file);&lt;br /&gt;               &lt;br /&gt;        web.Close();site.Close();&lt;br /&gt;&lt;br /&gt;    // ...&lt;br /&gt;&lt;br /&gt;public string CheckOutDocument(string page, string outFile)&lt;br /&gt;{&lt;br /&gt;    SPSite site = new SPSite(page);&lt;br /&gt;    SPWeb web = site.OpenWeb();&lt;br /&gt;    SPFile file = web.GetFile(outFile);&lt;br /&gt;&lt;br /&gt;    if (file.Exists)&lt;br /&gt;    {&lt;br /&gt;        if (SPFile.SPCheckOutStatus.None == file.CheckOutStatus)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                file.CheckOut();&lt;br /&gt;                web.Close();&lt;br /&gt;                site.Close();&lt;br /&gt;&lt;br /&gt;    //...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I call the methods with:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SharePointService.SPService _svc = new SharePointService.SPService();&lt;br /&gt;_svc.Credentials = CredentialCache.DefaultCredentials;&lt;br /&gt;string result = _svc.CheckOutDocument(page,thisXDocument.URI);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Does anyone know a reason for this odd behavior?&lt;br /&gt;Would be great if I could get this work ...</description></item></channel></rss>