Asked  7 Months ago    Answers:  5   Viewed   11 times

I'm using Outlook 2007 - and have my main mailbox: Tait, Mark

I have also added another mailbox to my profile: Procurement, Request

Both appear as top level folders within Outlook:

Mailbox - Tait, Mark> -Conversation History
-Deleted Items
-Junk E-Mail

Mailbox - Procurement, Request
--Conversation History
--Deleted Items
--Junk E-Mail

I can get a reference to my default Inbox (Tait, Mark) using:
Set Inbox = ns.GetDefaultFolder(olFolderInbox)

How do I get a reference to the Inbox in the "Procurement, Request" mailbox?



Something like this should do the trick

Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Set objNS = GetNamespace("MAPI")
Set objFolder = objNS.Folders("Procurement, Request")
Set objFolder = objFolder.Folders("Inbox")

This link has some useful code for handling different Inboxes - it may be of interest

Tuesday, June 1, 2021
answered 7 Months ago

You need to make a registry entry to tell Visual Studio which folders to show assemblies for. This article explains how to do it:

We don't use the GAC anymore as it is a cumbersome process that wasn't giving benefit to our team members. We solve the consistent path issues using project references for our own assemblies. Third party assemblies go in a folder within the solution and we reference the assemblies in the projects from there. This way everyone has them in the same path with no worries.

Friday, July 30, 2021
answered 5 Months ago

did you tried:

txtSearch = "category:=""Red category"""


Sub Red()
Dim myOlApp As New Outlook.Application
txtSearch = "category:=""Red category"""
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub
Sunday, August 29, 2021
Pablo Castro
answered 4 Months ago


It appears that your question has largely been answered. I will merely add a bit of information for clarity's sake, and to provide this question with an answer. A user on the Microsoft Forums, Ossiemac, noted that LateBinding was the way to go, as has been stated by Siddarth Rout. As implied by Siddarth, that means you do not have to worry about references.

Ossiemac provided some sample code for using the LateBinding in the sending of an email, which I have reformatted and placed here:

Private Sub btnLateBindMethod_Click()
    ' Variables used for LateBinding
    Dim objOutlook As Object    'Outlook.Application  
    Dim objEmail As Object      'Outlook.MailItem     
    Dim objNameSpace As Object  'Outlook.NameSpace    
    Const OutLookMailItem As Long = 0    'For Late Binding
    Const OutLookFolderInbox As Long = 6 'For Late Binding
    Const OutLookFormatHTML As Long = 2  'For Late Binding
    Dim strSubject As String
    Dim strAddress As String

On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0     

    If objOutlook Is Nothing Then
        Set objOutlook = CreateObject("Outlook.Application")
        Set objNameSpace = objOutlook.GetNamespace("MAPI")
    End If

Set objEmail = objOutlook.CreateItem(OutLookMailItem)

strSubject = "Hello World"

    With objEmail

        '.To = strToAddress  'Commented to prevent accidental send

        .Subject = strSubject

        .BodyFormat = OutLookFormatHTML


        'Full Name of window can change depending on Tools -> Options -> Mail Format
        'Changing this option for outgoing mail changes the window name.
        'However, AppActivate appears not to require entire name but needs up to end
        'of - Message which is included in heading following the Subject string
        'irrespective of the Mail Format option chosen.
        AppActivate (strSubject & " - Message")

    End With    
End Sub

Jimmy Pena has an article discussing the contrast of EarlyBinding and LateBinding -


Friday, November 5, 2021
Martin Vseticka
answered 1 Month ago

You are doing it wrong. You shoud save a reference to your Materials object then pass it as argument to Regenerators


class Materials(Document):
    title = StringField(unique=True, required=True)

class Regenerators(Document):
    material = ReferenceField(Materials, required=True)

m = Materials(title='aisi304').save()

r = Regenerators(material=m).save()

Then your documents look like this:

> db.regenerators.find()
        "_id" : ObjectId("565c9d110acf4510cf1f8712"),
        "material" : ObjectId("565c9cfc0acf4510cf1f8711")
> db.materials.find()
{ "_id" : ObjectId("565c9cfc0acf4510cf1f8711"), "title" : "aisi304" }

If you want to use a reference to an existing document you need to issue a query using the .get method then pass it reference as argument to Regenerators

m = Materials.objects.get(title='aisi304')
r = Regenerators(material=m).save()
Friday, December 3, 2021
answered 4 Days ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :