Delete file from WSS library - InfoPath Dev
in

InfoPath Dev

Delete file from WSS library

Last post 01-23-2008 09:07 AM by KoopLaFez. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-10-2007 03:51 PM

    Delete file from WSS library

    Hi,

    I am trying to move a file to a different folder in the same library. I create a form once is completed I need to send it to "history" another folder in the same library, once I click send to history I need for that form to be delete from the original location. Are they any ways to do this? I was looking this http://www.infopathdev.com/blogs/agni/archive/2006/03/12/Delete-File-from-SharePoint.aspx (Agni Reddy), to be honest I did all the steps, but at the end I didn’t know what to do. For example

    http://Sharepointserver/libraryName/application-55666.xml I need for this to get move to http://Sharepointserver/libraryName/HISTORY/application-55666.xml and I don’t need it in the original location anymore.

    Thanks in advance

    From the best team
    Tech Trouble
  • 10-10-2007 07:26 PM In reply to

    Re: Delete file from WSS library

    I think you would have two steps to this.

     First would be a special submit which would place the file in the histroy folder.

    The second would be the deletion of the original.

    I have done the deletion before, the key is making sure you specify the correct site and then getting the list ID correct.  If you use a parent site then this will not work.

    So once the form was complete or ready to be archived you would need to submit to history and then submit the deletion routine.

    Does that help?

  • 10-11-2007 06:02 AM In reply to

    Re: Delete file from WSS library

    Thank you Clay for your help, this may sound a little “duh!”, there is my problem, I don’t know how to create that routine, I have try VB and C, but they do not work, I mean I don’t know how to make them work. Could you help me with that? Or any help is a big help

    Thanks again

     

    From the best team
    Tech Trouble
  • 10-11-2007 06:20 AM In reply to

    Re: Delete file from WSS library

    You obviously have the submit dataconnection for saving the form in SharePoint.

    You would need to create another that was identical except it adds the History folder.

    The you would setup the two data connections specified by Agni in his post on deleting. You can do it without code too.

    In your case you would need to set the name for each file you were going to delete.

     

    Another option is you could look at the Database Accelerator Qdabra Database Accelerator Suite Version 2.1.2815 - Developer and you could evaluate the benefits of using SQL to store your forms over SharePoint.

    Otherwise, if you are really stuck you can buy some support credits here http://www.qdabra.com/products_all.asp?cat=12 and we could help you get your form working the way you need it to.

    Filed under:
  • 01-23-2008 09:07 AM In reply to

    • KoopLaFez
    • Not Ranked
      Male
    • Joined on 01-22-2008
    • San Diego, CA
    • Posts 21

    Re: Delete file from WSS library

    I had the same problem with Agni Reddy's instructions.  It worked great till I got to the end and the code was in C Sharp.  I'm running InfoPath out of the Office Suite, so I can only use Javascript or VB Script.  I fooled around with it a little bit, though, and was able to come up with a workable equivalent in Javascript.  Here's what I came up with:

     function deleteFile(fileName)
    {        
        XDocument.GetDOM("UpdateListItemsConfig").selectSingleNode("/UpdateListItemsConfig/SharepointDelete/Batch/Method/Field[@Name = 'FileRef']").text = fileName;
        XDocument.DataAdapters("SharePointDelete").Submit();  
    }
     

    I should mention that not only am I green when it comes to SharePoint and InfoPath, but also Javascript and XML, so this solution might be horrendously inelegant for all I know, but it works, so I thought I'd pass it along. 

     

     

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.