Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Creating a web view folder inside a folder in MS Outlook

Back to Forum: Tech Off
  • User profile image
    Sathyaish Chakravarthy

    I am creating a heirarchy of sub-folders, each with a web view and a web url.

    It all works fine for the main top level folder. However, when I click on the sub folders, they do not have their web view on. Nor do they have a web url in their properties. What gives?

    Here's the code.

    Private Sub Login()
            Dim lSettings As Settings = GetPersistedSettings()
            Dim nm As Outlook.NameSpace
            Dim folders As Outlook.Folders
            Dim fldfoo As Outlook.MAPIFolder
            Dim exp As Outlook.Explorer

            nm = applicationObject.GetNamespace("MAPI")
            fldfoo = nm.Folders.GetLast()
            fldfoo.Name = "foo"
            fldfoo.WebViewOn = True
            fldfoo.WebViewURL = "" & lSettings.UserName & "&password=" & lSettings.Password
            fldfoo.WebViewAllowNavigation = True
            exp = CType(applicationObject, Outlook.Application).ActiveExplorer
            Log.Write("Set the exp object to the active explorer in Outlook")
            exp.CurrentFolder = fldfoo
            Log.Write("Set the newly created foo folder as the current folder in the active explorer")
            Call CreateSubFolders(fldfoo)

        End Sub

        Private Sub CreateSubFolders(ByVal fldfoo As Outlook.MAPIFolder)
            Dim doc As XmlDocument = New XmlDocument
            Log.Write("Loaded XML doc")
            If doc Is Nothing Then Exit Sub
            Log.Write("XML doc has content")
            Call CreateSubFolder(doc.DocumentElement, fldfoo)
            Log.Write("finished creating folder heirarchy")
            doc = Nothing
        End Sub

        Private Sub CreateSubFolder(ByVal ndParent As XmlNode, ByVal fldParent As Outlook.MAPIFolder)

            Log.Write("Entered CreateSubFolder")
            For Each nd As XmlNode In ndParent.ChildNodes
                If TypeOf nd Is XmlElement Then
                    If nd.Name = "uitab" Then
                        Log.Write("For Each nd As XmlNode In nd.ChildNodes: " & nd.Name)
                        If Not nd.Attributes Is Nothing Then
                            Log.Write("If nd.Attributes.Count > 0 Then")
                            If (Not (nd.Attributes("display") Is Nothing)) Then
                                Log.Write("nd " & nd.Attributes("display").Value)
                                Dim fldNew As Outlook.MAPIFolder = fldParent.Folders.Add(nd.Attributes("display").Value)
                                Log.Write("Created a new MAPI Folder: " & nd.Attributes("display").Value)

                                fldNew.WebViewOn = True
                                fldNew.WebViewURL = nd.Attributes("href").Value
                                Dim StrURL As String = nd.Attributes("href").Value
                                fldNew.WebViewAllowNavigation = True

                                Log.Write("Set the description")
                                If nd.HasChildNodes Then
                                    Log.Write("nd has child nodes")
                                    Call CreateSubFolder(nd, fldNew)
                                End If
                            End If
                        End If
                    End If
                End If
        End Sub

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.