get access to a Contact Item from VBS

M

Martin

i'm trying to get access to a contact item in a public folder with the
following vbs script:

Set myOlApp = CreateObject("Outlook.Application")

Set olNS = myOlApp.GetNamespace("MAPI")

Set MyFolder = olNS.Folders("Öffentliche Ordner").Folders("Alle
Öffentlichen Ordner").Folders("econtact") 'ACHTUNG FOLDER ANPASSEN
'Set MyFolder = olNS.GetDefaultFolder(10)

Set MyItems = MyFolder.Items
Set MyItem =
MyItems.Find("[guid]='{4FE30271-8F48-4306-9912-1B45E1E3DAC8}'")

MyItem.Display
....

My Script works with the GetDefaultFolder Method in my Folder, but not in
this public folder.

Has anybody an advice how it works?

Thx Martin
 
S

Sue Mosher [MVP-Outlook]

Did you add a custom Outlook property to the folder named "guid"? That's a
requirement for using Find.
 
M

Martin

Sue,

my custom Outlook property is "guid" in my Public Folder.

Martin

Sue Mosher said:
Did you add a custom Outlook property to the folder named "guid"? That's a
requirement for using Find.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Martin said:
i'm trying to get access to a contact item in a public folder with the
following vbs script:

Set myOlApp = CreateObject("Outlook.Application")

Set olNS = myOlApp.GetNamespace("MAPI")

Set MyFolder = olNS.Folders("Öffentliche Ordner").Folders("Alle
Öffentlichen Ordner").Folders("econtact") 'ACHTUNG FOLDER ANPASSEN
'Set MyFolder = olNS.GetDefaultFolder(10)

Set MyItems = MyFolder.Items
Set MyItem =
MyItems.Find("[guid]='{4FE30271-8F48-4306-9912-1B45E1E3DAC8}'")

MyItem.Display
...

My Script works with the GetDefaultFolder Method in my Folder, but not in
this public folder.

Has anybody an advice how it works?

Thx Martin
 
S

Sue Mosher [MVP-Outlook]

This is a shot in the dark, but try using a regular quotation mark:

strFind = "[guid]=" & Chr(34) & "{4FE30271-8F48-4306-9912-1B45E1E3DAC8}"
& Chr(34))
Set MyItem = MyItems.Find(strFind)

If that still doesn't work, then I'd double check that there really is such
a property defined ***in the folder*** not just in the item. I know you said
it's there, but an ill-defined or missing property is the most common cause
of the problem you're having.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Martin said:
Sue,

my custom Outlook property is "guid" in my Public Folder.

Martin

Sue Mosher said:
Did you add a custom Outlook property to the folder named "guid"? That's a
requirement for using Find.


Martin said:
i'm trying to get access to a contact item in a public folder with the
following vbs script:

Set myOlApp = CreateObject("Outlook.Application")

Set olNS = myOlApp.GetNamespace("MAPI")

Set MyFolder = olNS.Folders("Öffentliche Ordner").Folders("Alle
Öffentlichen Ordner").Folders("econtact") 'ACHTUNG FOLDER ANPASSEN
'Set MyFolder = olNS.GetDefaultFolder(10)

Set MyItems = MyFolder.Items
Set MyItem =
MyItems.Find("[guid]='{4FE30271-8F48-4306-9912-1B45E1E3DAC8}'")

MyItem.Display
...

My Script works with the GetDefaultFolder Method in my Folder, but not in
this public folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top