SpFolder.Delete() How it works?

Hello,
I want to achieve rather simple thing. At timer job, I want to delete folder in Document library if it exists.
So part of code that handles it is like, which is simple
Dim folderDestAs As SPFolder = Web.GetFolder(FolderDestURL)                           
folderDestAs.Delete()
What I would like to learn is what will happen if at the same moment Delete action is being called, someone is in download progress of some file inside this folder?
So far I know, Delete wont happen if some file is checked out or being edited, but downloading scenario is unknown to me.
If downloading a file inside a folder I want to delete will prevent deleting, what is then recommended way to delete folder? Is it using some sort of while loop with Thread.Sleep or something else?
Thank you in advance
Milos

Try below:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/52c64dd6-6e4b-4369-af10-38e29bc14a85/force-to-delete-a-spfolder-contains-some-checkout-files
SPSecurity.RunWithElevatedPrivileges(delegate()
using (SPSite site = new SPSite("http://test/sites/dev/"))
using (SPWeb web = site.OpenWeb())
web.AllowUnsafeUpdates = true;
SPDocumentLibrary docs = (SPDocumentLibrary)web.Lists["Library1"];
foreach (SPFile file in docs.RootFolder.Files)
if (file.CheckOutType == SPFile.SPCheckOutType.Online)
Console.WriteLine(file.Name);
file.CheckIn("Comment");
web.AllowUnsafeUpdates = false;
he differents is I'm not using CheckedOutFiles. Using CheckedOutFiles  doesnt return you all checked
out items, only new items that have not been checked in.
you can read more about it here http://paddyt.blogspot.com/2012/05/spdocuementlibrarycheckedoutfiles.html
If this helped you resolve your issue, please mark it Answered

Similar Messages

  • On my ipod touch I'm not too sure how I uploaded a album onto my ipod from my laptop. But, now there is no way to delete the album full of pictures. What do I do? I only gotten it a while ago and not fully sure how to work it. Help?

    On my ipod touch I'm not too sure how I uploaded a album onto my ipod from my laptop. But, now there is no way to delete the album full of pictures. What do I do? I only gotten it a while ago and not fully sure how to work it. Help?

    http://support.apple.com/kb/HT4236

  • I deleted an old work email account on my iPhone4 and it deleted all my contacts! How do I get them back?

    I deleted an old work email account on my iPhone4 and it deleted all my contacts! How do I get them back?

    The iPhone does not store ANY information on the SIM card. If they were truly on the SIM, re-import them from the SIM.
    Settings>Mail, Contacts, Calendars>Import SIM Contacts.

  • In iTunes 11.1 (I26) , I cannot find how to delete podcast listings showing undownloaded podcasts. Delete does not work. Option Delete does not work.  Dragging to the trash does not work. Under Edit, Delete is greyed out. Mac OS 10.6.8

    in iTunes 11.1 (I26) , I cannot find how to delete podcast listings showing undownloaded podcasts. Delete does not work. Option Delete does not work. Dragging to the trash does not work. Under Edit, Delete is greyed out. Mac OS 10.6.8.
    Tom at the Genius Bar told me that Option Delete would work. It does not.
    I had to upgrade to iTunes 11.1.(I26) because it is required with OS7 on my iPod Touch (5th Gen). I have tried shutting down iTunes, then shutting down the entire system. This is the first in many visits that the Genius Bar gave me a solution that did not work.
    This is a big awkward computer locked to my desk. I would rather not unlock it and then carry it through a shopping center to the Genius Bar if i can avoid oit.
    When I installed iTunes 11.1, I discovered that Ihad to resubscribe to virtually all of the podcasts that I had previously been subscribed to. That was a surprise.

    Hello Achates:
    I did not read the rather long post. If you wish to reinstall OS X 10.4, use your software install DVD. Backup is essential. To minimize your risk, I would use an archive and install:
    http://docs.info.apple.com/article.html?artnum=107120
    In that way, you will have a fresh copy of OS X and your current settings will be preserved.
    Incidentally, I do not agree that the printer problem is best solved by reinstalling OS X. I have had HP printers for sometime and, on one occasion, had difficulty after an upgrade. HP technical support walked me through uninstalling all traces of the HP driver and then reinstalling.
    Barry

  • I installed google chrome and added it to my applications folder and it works but my desktop still has the icon of the chrome volume/disk and when i right click it gives an option to eject but it will not delete how can I get rid of it?

    I installed google chrome and added it to my applications folder and it works but my desktop still has the icon of the chrome volume/disk and when i right click it gives an option to eject but it will not delete how can I get rid of it?

    Drag it to the trash icon in your dock.  This is a disk image, and you need to "eject" it, to get rid of it.  

  • Anyone.know.how.to.get.spacebar.and.delete.button.to.work??

    anyone.know.how.to.get.spacebar.and.delete.button.to.work??

    I think you are asking this in the wrong forum.  This is for TBD issues.

  • Hallo My system runs slow. how can i reorganize the date, that the pc runs faster? In the window world i hade to delete some fils. how it work in the apple world?

    Hallo My system runs slow. how can i reorganize the date, that the pc runs faster? In the window world i hade to delete some fils. how it work in the apple world?

    See these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual, Mountain Lion Edition.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.
    Once you get familiar with the Mac, see:
    Mac Maintenance Quick Assist,
    Mac OS X speed FAQ,
    Speeding up Macs,
    How to Speed up Macs, ,
    Macintosh OS X Routine Maintenance,
    Essential Mac Maintenance: Get set up,
    Essential Mac Maintenance: Rev up your routines,
    Maintaining OS X, 
    Five Mac maintenance myths and
    Myths of required versus not required maintenance for Mac OS X for information.

  • My ipad died while i was working on a project when i turned it back on all my work was deleted how d

    my ipad died while i was working on a project when i turned it back on all my work was deleted how do i get it back?

    I'm afraid your work is gone. The work you do to PDFs is saved when exiting your application, so if you didn't save your document, your work is gone. Sorry .

  • At the top of my Mozilla home page, it lists the current URL site I am on. How do I delete them and the others in the drop down box? Highlighting and hitting delete does not work

    At the top of my Mozilla home page, it lists the current URL site, such as http://www.safeco.com, I am on plus the others in the drop down box. How do I delete them. Highlighting and hitting delete does not work.
    I am using windows Vista 007 and Mozila 3.6.1.3

    Do those entries have a yellow star at the far right?
    If they have then they are bookmarks. You can remove them if you open that link and click the star to open the Edit This Bookmark dialog and click the Remove button in that dialog.
    * [[Clearing Location bar history]]
    * [[Cannot clear Location bar history]]

  • ITunes 10.4.1.10 how to stop downloads of free news pods?  (right click delete doesn't work) also can't scroll down list of downloads!

    (ITunes 10.4.1.10) How to stop downloads of free news pods?  (right click delete doesn't work)
    Also can't scroll down list of downloads so as to pause them.  Would like to delete them as ISP has download limit.
    Thanks in advance!  (this seems to be a dumb problem of the software having a life of its own!)

    I have been talking to Apple support about this very problem. So far they have asked me to disable both Firewall and Anti Virus software (Windows Firewall and ESAT NOD32 anti virus) - this didn't work. Rebuild my library - this didn't work. Un-install all Apple applications and re-install - this didn't work. I have created a second user account on my PC and from that account (both accounts set as Administrator) I can activate Genius. This suggests to me that the problem is possibly linked to my original User Account, which is the one I always use. I am waiting for the next update from Apple and will post an update if/when the problem is resolved.
    What I also notice is about 2 seconds in to Step 2 of the Genius activation, the progress diagonal lines bar stops, and then starts again. As soon as I see this short freeze I know that the activation will fail.

  • HT3386 How do you remove part of a file. My thumbnail attach themselves then refuse to allow editing without deleting my complete work. I even scan in jpegs of my documents and it incessantly adds blanks I can't remove.

    How do you remove part of a file. My thumbnail attach themselves then refuse to allow editing without deleting my complete work. I even scan in jpegs of my documents and it incessantly adds blanks I can't remove.

    Pages documents are organized in sections. When you click on the thumbnail for a page, the section containing that page is selected. The Delete command applies to the selection, so if you press delete at this point, the selected section is deleted.
    You can separate a section into two or more sections by inserting a section break at the end of the page before the page you want ot be the first in the new section, then inseritng a second section break where you want the second section to end. Click on the thumbnail for any page in the new section, thenpress delete and the new section will be deleted.
    If desired, you can then reconnect the two remaining sections into one by deleting the section break between them.
    An alternate is to select any floating objects on the pages you want to delete, then press delete. After that, select the text on the pages you want to delete, then press delete.
    If all objects on these pages (and al objects on pages following these pages) have been placed as Inline objects, this deletion may be done in a single step. Floating objects placed below the deleted material will maintain their position relative to the top left corner of the first page of the section,m and will not be in the same place within the text as they were before the deletion.
    "I even scan in jpegs of my documents and it incessantly adds blanks I can't remove."
    If your jpegs are inserted as inline objects, each will be treated as a single, large character in the text. You will see the same space left and right of the object as you would create by increasing the height of one character in the line of text to the same size as the height of the jpeg image.
    If they are inserted as floating objects, then depending on the Wrap settings, they may force text out of the space to the left, right, or both sdes of the object, as well as forcing a small gap above and below the object. If the scan includes excess white space around the graphic, this white space will be included as part of the object
    Regards,
    Barry.

  • I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the thief logs out of iCloud. Would we able to locate the macbook?

    I was looking at the "Find my iPhone" app and I have a doubt regarding how it works for the macbook. In order to detect the location, the macbook should remain signed into iCloud. What if the person who has stolen my macbook logs out of iCloud.
    It should work fine for iPhone/iPad because we can enable "Restrictions" to prevent the user from signing out of iCloud. Do we have simialr settings for the macbook?
    Thanks,

    If it's not on the device list, it indicates that someone has gone to Find My iPhone on icloud.com and manually deleted it from the device list (as explained here: http://help.apple.com/icloud/#mmfc0eeddd), and it has not gone back online since (which would cause it to reappear on the device list; Find My iPhone has been turned of in settings on the device; the iClolud account has been deleted from the device; or the entire devices has been erased and restored.
    Unfortunately, there's no other way to track the phone other than through Find My iPhone.  You could call your carrier and see if they would blackliste it so at least the theif couldn't use it.

  • I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this and replace it with my personal iPhone?

    I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this from my ipad and replace it with my personal iPhone?

    Hi Ktchast,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    An Apple ID is a user name you use for everything you do with Apple. Creating an account for an Apple service, such as the iTunes Store or the App Store, creates an Apple ID. Apple ID allows you to access other Apple services. You don't have to create a new account for each service—just use your Apple ID.
    How do I change my Apple ID Name or personal information?
    You can change your Apple ID Name at My Apple ID. Click on Manage your Apple ID and sign in with your Apple ID name and password. Click Edit and enter the new information, then click Save Changes. Changes take effect immediately. You can also use My Apple ID to change your personal information, such as your mailing address or email address. See Changing the name you use for your Apple ID if you'd like more information.
    Cheers,
    - Judy

  • Win 2102: existing number of virtual desktops is not valid after errors while deleting , how to fix it ?

    Hello everyone,
    I created a virtual desktop collection with a name format like this , prefix = VDI-, suffix= 1 .
    so when I created the first VMs , I had VDI-1 and VDI-2 , later after recreating the VMs, adding new ones and deleting others, the suffix numbers are no longer in sequence , like I started having VDI-1,VDI-2,VDI-8,VDI-9.
    I realized I had one problem that probably caused this, because when I delete a VM , I get a warning message:
    "RD connection broker could not delete the computer account object from active directory."
    so I searched about that error and I added the needed permissions and now deleting seems to work without any warning.
    now I have two VMs, when I go through the wizard , the first page it shows I have 2 VMs but in the second page it shows I have 11 ! is there a way to reset the count ? if I delete the entire collection and create it again , will I have any problem with the
    roaming users profiles ?
    Thanks

    Hi,
    Thank you for your posting in Windows Server Forum.
    You can specify the count for RDVH as how many desktop wants for particular host. You can do this “Specify Virtual Desktop allocation” while creating virtual desktop collection. Other than that you can also use PowerShell command to achieve your task.
    For more details you can refer beneath article.
    1. Fumbling through Windows Server 2012 Virtual Desktop Infrastructure (VDI)
    2. Deploying VDI for RDS 2012 / 2012R2 – Part II – Publishing a Windows 7 Pooled Desktop
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Trying to understand how beans work.

    I can't seem to figure out how beans work. Or more specifically how to target different parts of a bean. I think not knowing the terminology is a big part of this confusion too.
    For instance. I have a jsp file and a bean. the jsp has a form input that submits to itself. the bean gets the info that was typed in and displays is in the <%= etcetc %> tag. Now, what im trying to do is also submit that value to my mysql db. This has created numerous problems for me. For one, i don't really know how to check if it's working (other than actually looking at the DB table). The other problem is how do i target that part of the bean to tell it to do that function (again, the terminolgy eludes me).
    I'll post all of the code. There is a good chance that the DB code wont work. I'm really just hoping someone can explain to me
    how i call the DB function from the JSP file.
    I mean, is this even possible? Or do i need seperate beans for everything?? It seems kind of silly to not be able to do this.
    ok, so here is the code.
    JSP:
    <!-- JSP Directives -->
    <%@ page errorPage="myError.jsp?from=hello.jsp"%>
    <jsp:useBean id="simpleBean" scope="page" class="jspbook.ch3.simpleBean"/>
    <!-- Set bean properties -->
    <jsp:setProperty name="simpleBean" property="fname"/>
    <html>
    <head>
         <title>Hello</title>
    </head>
    <body>
    <center>
         <b><%= simpleBean.welcomeMsg() %></b>
    </center>
    <table align="center">
         <tr>
              <td>
                   <form name="sdfsdf" action="test.jsp" method="post">
                   <input type="text" name="fname" value="">
                   <input type="submit" name="submit" value="submit">
                   </form>
              </td>
         </tr>
    </table>
    </body>
    </html>and here is the bean
    package jspbook.ch3;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    public class simpleBean implements java.io.Serializable {
       private String emplid;
       private Connection con = null;
       private ResultSet rs = null;
       private PreparedStatement st = null;
       /* Member Variables */
       private String lname;
       private String fname;
      public simpleBean()
            try
              Class.forName("org.gjt.mm.mysql.Driver");
              Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stm?user=root&password=");
        catch(Exception e)
              System.out.println(e.getMessage());
          /* Initialize bean properties */
        setLname("");
        setFname("");
      /* Accessor Methods */
      public String getLname() {
        return lname;
      public void setLname(String _lname) {
        lname = _lname;
      public String getFname() {
        return fname;
      public void setFname(String _fname) {
        fname = _fname;
      /* Display personalized message */
      public String welcomeMsg() {
        return "Hello " + fname + " " + lname +
          ", welcome to the wonderful world of JavaBeans!";
          public void insert()
           try
                String s1="insert into commstream (commTitle) values('"+fname+"')";
                st = con.prepareStatement(s1);
                st.executeUpdate();
                st.clearParameters();
                st.close();   
           catch(Exception m)
    }So there it is. If someone can explain the fundamentals to me, that would be great. What would also be great is if someone can make the above code work :)
    I've checked online tuts/specs on this, but to be honest im just not grasping it.

    iPhoto is a relational database program
    In the strongly recommended managed library (you have chosen to ignore this recommendation and use a referenced library) imported photos are copied to the iPhoto library and stored in the originals folder, a thumbnail jPEG is created and places in the data folder and when any modification is made (including autorotation) a modified version of the photo is created and placed in the modified folder. iPhoto updates its database entries to reflect everything it does.
    It is critical that you do not make any modifications of any sort to the content or structure of the iPhoto library - doing so is likely to corrupt the library and cause you to lose data.
    When you use the referenced mode which you are doing (and which is not recommended) you are taking total responsibility for the original photos which included not moving or modifying them while iPhoto is referencing them
    Unfortunately, all pictures from a certain import has duplicated in iPhoto.... so I "moved to trash" all pictures from that import
    Did you do this with the iPhoto trash? or did you use the finder to modify the contents of the iPhoto library.
    If I "move to trash", I assumed it got rid of whatever index (and preview cache) to that particular JPEG. I was actually surprised it did not delete the actual JPEG but I'm ok with that.
    again - iPhoto trash or finder trash. If you move a photo to the iPhoto trash and empty it all traces of that photo in the iPhoto library will be removed - nothing will be done to any file outside of the iPhoto library -- ever
    LN

Maybe you are looking for

  • Itunes crashes when importing music (v10.5.2.11, Win 7 (64))

    iTunes crashes whenever I try to import either a file or folder - regardless of the file format (e.g. WMA, MP3 etc.).  This is only a recent problem.  Is the only option to try to re-install iTunes?  Thanks for any assistance.  Dyswim

  • PO validation for date

    Need the control to change PO line items based on PO document creation date, User can change PO line items quantity only before 14 days from PO creation date & should not allow to change after 14 days from data of creation PO.This control should be a

  • ORA-27123 unable to attach shared memory segment

    Running oracle 8.1.5.0.0 on Redhat 6.0 with kernel 2.2.12, I keep getting the error ORA-27123 unable to attach shared memory segment when trying to startup and instance with an SGA > 150 MB or so. I have modified the shmmax and shmall kernel paramete

  • Airplay disappeared off my iphone 6

    I'm using ios 8.3 on my iphone 6 and airplay has ceased functioning.  Airplay doesn't even appear in the control panel when I drag it up from the bottom of the screen.  I do a search for 'airplay' on the phone and it finds nothing except internet sit

  • Interactive form and program for SD invoice

    Hi, is there example of adobe form and print program in ECC 6.0 for SD invoices? I tried also to find some predefined forms on OSS but no success. Regards Peter