API to enable web sharing programmatically

Posted on 2006-06-07
Last Modified: 2007-12-19
Is there any API or some way in VB to enable web sharing for a folder programmatically?

Thanks in advance.
Question by:sankarbha
    LVL 26

    Accepted Solution

    Set oIIS = GetObject("IIS://localhost/W3SVC/1/root")  '
        Set oVirtualDir = oIIS.Create("IIsWebVirtualDir", "your Virtual directory name")
        oVirtualDir.Path = "your full path"
        oVirtualDir.AccessRead = True
        oVirtualDir.AccessWrite = True
        oVirtualDir.AccessExecute = True
        oVirtualDir.AuthAnonymous = False
        oVirtualDir.AuthBasic = False
        oVirtualDir.AuthNTLM = True
        oVirtualDir.ContentIndexed = True
        oVirtualDir.EnableDirBrowsing = False
        oVirtualDir.AppIsolated = False
        oVirtualDir.AspBufferingOn = True
        oVirtualDir.AspSessionTimeout = 1
        If InStr(1, oVirtualDir.DefaultDoc, "Default.asp") = 0 Then
            oVirtualDir.DefaultDoc = "Default.asp, " & oVirtualDir.DefaultDoc
        End If
        oVirtualDir.EnableDefaultDoc = True
        Call oVirtualDir.AppCreate(True)
        oVirtualDir.AppFriendlyName = "your PackageName"
        Call oVirtualDir.SetInfo
        Set oVirtualDir = Nothing
        Set oIIS = Nothing
    LVL 8

    Author Comment

    Great its working. Thanks EDDYKT.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now