Redemption/OOM: current machine name

W

WLAN

Hello ALL,

Is there anyway to get machine name from outlook object model or redemption
dll? I have a use case where i need to inject some custom action on
FOLDERCREATE event. So I have subscribed FOLDERCREATE event of exchange store.

Now if the same user is logged on different machines and try to create
folder in mail box. It executes the custom action in all machines.

How do I solve this issue?

I want to limit it to the machine where he has created the folder. I know
that event is subscribed across mailbox level. But anyway to limit it to
machine level?

If I get machine name from object model, i can compare it with current
machine name and limit the execution of custom action.

Thanks in Advance.
 
K

Ken Slovak - [MVP - Outlook]

Neither Redemption nor the Outlook object model have properties or methods
to get the machine name. How you'd do that would depend on what language and
development platform you are using.

For example, with managed code using C# you'd use this:

string machineName = System.Environment.MachineName;

VB6 and VBA don't have native methods to get the machine name, in those
cases you would need to use a Win32 API call to GetComputerName in kernel32
to get that. For VB/VBA code see
http://www.visualbasic.happycodings.com/Applications-VBA/code23.html for an
example.
 
W

WLAN

Thanks Ken.

If same user opens mailbox from different machines using Outlook. Is there
anyway to differentiate?

Basically i need to know any mechanism exists for differentiating outlook
client PCs?
 
K

Ken Slovak - [MVP - Outlook]

Same mailbox, same user id. So no way to tell from those where the code is
being run. Use one of the methods I just described to get the machine name,
depending again on what language and platform you are using. Then whichever
machine subscribes to your event first can write out a hidden message in
Inbox or elsewhere identifying the machine controlling that event, and
delete that message when the code exits to prepare for the next run. Or you
can store the flag in a folder property or some other location that travels
with the mailbox.
 
W

WLAN

How do I create a hidden item?



Ken Slovak - said:
Same mailbox, same user id. So no way to tell from those where the code is
being run. Use one of the methods I just described to get the machine name,
depending again on what language and platform you are using. Then whichever
machine subscribes to your event first can write out a hidden message in
Inbox or elsewhere identifying the machine controlling that event, and
delete that message when the code exits to prepare for the next run. Or you
can store the flag in a folder property or some other location that travels
with the mailbox.
 
D

Dmitry Streblechenko

RDOFolder.HiddenItems.Add
You can see these items in OutlookSpy: click IMAPIFolder button, go to the
"Associated Contents" tab.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
K

Ken Slovak - [MVP - Outlook]

Cached mode will only show changes after synching is done with the server,
until then it's operating from whatever is in the OST. Once the OST is
updated the change will be there in cached mode.
 

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