views:

930

answers:

3

I am using Outlook redemption to access all rules from outlook. How could we get RDORules using Outlook Redemption in c# ? I have tried accessing this using below code

Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._NameSpace ns = app.GetNamespace("MAPI");

Redemption.RDOSessionClass rdoSession = new Redemption.RDOSessionClass(); rdoSession.MAPIOBJECT = ns.MAPIOBJECT;

rdoSession.Stores.DefaultStore.Rules - Here Rules property not exist.

The reason is rdoSession.Stores.DefaultStore return RDOStore object and Rules property exist in RDOExchangeStore object.

and i am not able to access RDOExchangeStore object. cause store kind is "skPstUnicode" Is there any way to access RDORules ?

A: 

Could be a couple of things up here .. have you iterated through the stores to find the exchange store ? as it looks like that you are not connected to exchange or the default store is configured to be a PST.

Update: to Answer your extra questions.

You can use RDO directly against the Exchange Server i.e Out side of outlook as long as you are online

Redemption.RDOSession rdoSession = new Redemption.RDOSession(); Use the logon method on the RDOSession object.

76mel
A: 

yes you are correct i have to iterate to find the ExchangeStore. I have also one doubt Can i access Exchange Store from my local system if Yes then How? i am using outlook Redemption currently.

simon
A: 

QUESTION:

I want to run the same application using redemption in the client side where outlook is not installed or installed with other version. what should i do in this case? Should i remove MAPIObject from the RDOSession and this will work fine? Here is my code

Microsoft.Office.Interop.Outlook.Application app = null; Microsoft.Office.Interop.Outlook._NameSpace ns = null;

    **app = new Microsoft.Office.Interop.Outlook.Application();**
    **ns = app.GetNamespace("MAPI");**

Redemption.RDOSessionClass rdoSession = new Redemption.RDOSessionClass();

rdoSession.MAPIOBJECT = ns.MAPIOBJECT;

            rdoSession.LogonExchangeMailbox(USER, SERVER);
            Redemption.RDOExchangeMailboxStore exchangeStore = null;
            foreach (Redemption.RDOStore str in rdoSession.Stores)
            {
                string storeKindName = ((Redemption.RDOStore)str).StoreKind.ToString();

                if (storeKindName.Equals("skPrimaryExchangeMailbox") || storeKindName.Equals("skDelegateExchangeMailbox") || storeKindName.Equals("skPublicFolders"))
                {
                    exchangeStore = str as Redemption.RDOExchangeMailboxStore;
                }

                //al.Add(((Redemption.RDOStore)str).StoreKind.ToString());
                MessageBox.Show(((Redemption.RDOStore)str).StoreKind.ToString());
            }

Thanks for your help.

simon
Yes that is the way to go ... it would be cool if you posted new questions as new question as it helps other users on here.
76mel