Discussion:
Get delegates property for a contact.
(too old to reply)
Kalyan
2009-07-06 10:05:03 UTC
Permalink
Hi,
I have a requirement to get delegates(Send on behalf of [Tools > Options >
Delegates]) for a given contact address in VBA code.

Could you please help on this? How can I get the delegate property in
MAPI/Outlook object model?

-Kalyan
Ken Slovak - [MVP - Outlook]
2009-07-06 13:04:40 UTC
Permalink
There's no property exposed for that in the Outlook object model. If you're
using the MAPI COM library Redemption (www.dimastr.com/redemption) you can
get the RDOAddressEntry represented by that contact and use its Delegates
property.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Hi,
I have a requirement to get delegates(Send on behalf of [Tools > Options >
Delegates]) for a given contact address in VBA code.
Could you please help on this? How can I get the delegate property in
MAPI/Outlook object model?
-Kalyan
Kalyan
2009-07-27 02:32:01 UTC
Permalink
Hi Ken/Someone,

Is it possible to find this property from serverside code (VB.Net or C#.Net)
?. I couldn't locate it in Interop API(Microsoft) .. Is there any other API
or tool that exposes this so that I can get the value from server side code?

Many thanks
Kalyan
Post by Ken Slovak - [MVP - Outlook]
There's no property exposed for that in the Outlook object model. If you're
using the MAPI COM library Redemption (www.dimastr.com/redemption) you can
get the RDOAddressEntry represented by that contact and use its Delegates
property.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Hi,
I have a requirement to get delegates(Send on behalf of [Tools > Options >
Delegates]) for a given contact address in VBA code.
Could you please help on this? How can I get the delegate property in
MAPI/Outlook object model?
-Kalyan
Ken Slovak - [MVP - Outlook]
2009-07-27 15:19:07 UTC
Permalink
Server side code would use the same interfaces and would need a local copy
of Outlook installed. The server side code would also need to log into the
Outlook session as a Windows user with permissions to access whatever
mailbox was required.

That still wouldn't get you anything, you'd still have to use Redemption or
Extended MAPI. MAPI can only be programmed using C++ and unmanaged code and
has a long learning curve.

You might be able to query an Exchange server using Exchange Web services
(for Exchange 2007 or later) or using WebDAV for Exchange 2003. However that
you'd have to ask about in an Exchange development group, it wouldn't be
Outlook code at all in that case.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Hi Ken/Someone,
Is it possible to find this property from serverside code (VB.Net or C#.Net)
?. I couldn't locate it in Interop API(Microsoft) .. Is there any other API
or tool that exposes this so that I can get the value from server side code?
Many thanks
Kalyan
Kalyan
2009-07-28 16:08:01 UTC
Permalink
Thanks Ken.
I'm trying the following C# code for simple lookup of a contact. I've
registered the dll in registry and included reference in project (VS 2005)

public partial class Test1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Redemption.RDOSessionClass s1 = new Redemption.RDOSessionClass();
Redemption.RDOSession s1 = new Redemption.RDOSession();
s1.Logon(null,null,null,null,null,null);
Redemption.RDOAddressEntry entry =
s1.AddressBook.GAL.ResolveName("John");
delegateValue.Text = entry.Address + entry.Alias;
}
}

And I'm getting a runtime exception while creating RDOSession object and
same with RDOSessionClass.
Error Message:
Creating an instance of the COM component with CLSID
{29AB7A12-B531-450E-8F7A-EA94C2F3C05F} from the IClassFactory failed due to
the following error: 80040605.

Could you please help on this?

Equivalent code s running fine in vbscript(from webpage-client) and
delegates property too
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set AdrrEntries = Session.AddressBook.GAL.ResolveName("John")
MsgBox AdrrEntries.Name
set Addrdelagates = AdrrEntries.Delegates
count = Addrdelagates.Count
for i = 1 to count
MsgBox Addrdelagates.Item(i).Name
next
Post by Ken Slovak - [MVP - Outlook]
Server side code would use the same interfaces and would need a local copy
of Outlook installed. The server side code would also need to log into the
Outlook session as a Windows user with permissions to access whatever
mailbox was required.
That still wouldn't get you anything, you'd still have to use Redemption or
Extended MAPI. MAPI can only be programmed using C++ and unmanaged code and
has a long learning curve.
You might be able to query an Exchange server using Exchange Web services
(for Exchange 2007 or later) or using WebDAV for Exchange 2003. However that
you'd have to ask about in an Exchange development group, it wouldn't be
Outlook code at all in that case.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Hi Ken/Someone,
Is it possible to find this property from serverside code (VB.Net or C#.Net)
?. I couldn't locate it in Interop API(Microsoft) .. Is there any other API
or tool that exposes this so that I can get the value from server side code?
Many thanks
Kalyan
Ken Slovak - [MVP - Outlook]
2009-07-28 17:12:25 UTC
Permalink
If this is server side code whatever server is running the code must have
Redemption installed and registered, is that the case?

I'd also get rid of all those compound dot operators. That's a concoction
such as entry =
s1.AddressBook.GAL.ResolveName("John");

That sort of construct makes it hard to debug what's going wrong if
something does go wrong, plus it creates intrinsic object variables that
cannot be explicitly released such as ones for AddressBook, GAL, etc.
Especially in loops those can chew up available RPC channels when working
with Exchange stores, which can lead to unexpected memory errors. I'd
rewrite that code explicitly:

Redemption.RDOAddressBook book = s1.AddressBook;
Redemption.RDOAddressList gal = book.GAL;

etc.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Thanks Ken.
I'm trying the following C# code for simple lookup of a contact. I've
registered the dll in registry and included reference in project (VS 2005)
public partial class Test1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Redemption.RDOSessionClass s1 = new Redemption.RDOSessionClass();
Redemption.RDOSession s1 = new Redemption.RDOSession();
s1.Logon(null,null,null,null,null,null);
Redemption.RDOAddressEntry entry =
s1.AddressBook.GAL.ResolveName("John");
delegateValue.Text = entry.Address + entry.Alias;
}
}
And I'm getting a runtime exception while creating RDOSession object and
same with RDOSessionClass.
Creating an instance of the COM component with CLSID
{29AB7A12-B531-450E-8F7A-EA94C2F3C05F} from the IClassFactory failed due to
the following error: 80040605.
Could you please help on this?
Equivalent code s running fine in vbscript(from webpage-client) and
delegates property too
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set AdrrEntries = Session.AddressBook.GAL.ResolveName("John")
MsgBox AdrrEntries.Name
set Addrdelagates = AdrrEntries.Delegates
count = Addrdelagates.Count
for i = 1 to count
MsgBox Addrdelagates.Item(i).Name
next
Kalyan
2009-07-28 18:06:01 UTC
Permalink
Redemption is installed and registered(regsvr32 Redemption.dll) and added to
project reference. I'm getting the exception/error in the line below(object
creation itself) and the execution doesn't go beyond that line.
Redemption.RDOSessionClass s1 = new Redemption.RDOSessionClass();

I tried creating "Redemtion.MapiUtils" object in VB.Net/C# which is working
fine(even with compound dot operator.)

-Kalyan
Post by Ken Slovak - [MVP - Outlook]
If this is server side code whatever server is running the code must have
Redemption installed and registered, is that the case?
I'd also get rid of all those compound dot operators. That's a concoction
such as entry =
s1.AddressBook.GAL.ResolveName("John");
That sort of construct makes it hard to debug what's going wrong if
something does go wrong, plus it creates intrinsic object variables that
cannot be explicitly released such as ones for AddressBook, GAL, etc.
Especially in loops those can chew up available RPC channels when working
with Exchange stores, which can lead to unexpected memory errors. I'd
Redemption.RDOAddressBook book = s1.AddressBook;
Redemption.RDOAddressList gal = book.GAL;
etc.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Thanks Ken.
I'm trying the following C# code for simple lookup of a contact. I've
registered the dll in registry and included reference in project (VS 2005)
public partial class Test1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Redemption.RDOSessionClass s1 = new Redemption.RDOSessionClass();
Redemption.RDOSession s1 = new Redemption.RDOSession();
s1.Logon(null,null,null,null,null,null);
Redemption.RDOAddressEntry entry =
s1.AddressBook.GAL.ResolveName("John");
delegateValue.Text = entry.Address + entry.Alias;
}
}
And I'm getting a runtime exception while creating RDOSession object and
same with RDOSessionClass.
Creating an instance of the COM component with CLSID
{29AB7A12-B531-450E-8F7A-EA94C2F3C05F} from the IClassFactory failed due to
the following error: 80040605.
Could you please help on this?
Equivalent code s running fine in vbscript(from webpage-client) and
delegates property too
set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set AdrrEntries = Session.AddressBook.GAL.ResolveName("John")
MsgBox AdrrEntries.Name
set Addrdelagates = AdrrEntries.Delegates
count = Addrdelagates.Count
for i = 1 to count
MsgBox Addrdelagates.Item(i).Name
next
Ken Slovak - [MVP - Outlook]
2009-07-29 14:10:56 UTC
Permalink
Did you try creating a RDOSession object and not an RDOSessionClass object?

The compound dot operator thing won't prevent things from working usually,
it's for efficiency and for loops and for debugging. It's up to you if you
want to follow best practices or not.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Post by Kalyan
Redemption is installed and registered(regsvr32 Redemption.dll) and added to
project reference. I'm getting the exception/error in the line
below(object
creation itself) and the execution doesn't go beyond that line.
Redemption.RDOSessionClass s1 = new Redemption.RDOSessionClass();
I tried creating "Redemtion.MapiUtils" object in VB.Net/C# which is working
fine(even with compound dot operator.)
-Kalyan
Loading...