Profile and password usage issue in office 2003

We are developing an application which would read mail items from a common folder, let us say, TestEmailFolder (
I was given access and this folder (eg. TestEmailFolder) is configured to my profile also.

So programmatically I was able to read mail items from

But I want a generic profile with respect to  so that a windows service should be able to read mail items.
For that purpose I created another profile (say clientProfile) in outlook which points to Also I know the password.
I am trying to read mail items programmatically using following code

outlookNS.Logon(_strProfile, _strPwd, false, false);
inboxFolder = outlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

_strProfile would be clientProfile password would be that of

But still I get mail items from my inbox not from

Could you kindly advise how could I get mail items using a generic profile not using that of my profile?

Outlook.ApplicationClass oOutlkApp;
        Redemption.SafeMailItem oSafeMailItem;
        Outlook.NameSpace outlookNS;
        Outlook.MAPIFolder inboxFolder;
        oOutlkApp = new Outlook.ApplicationClass();
        outlookNS = oOutlkApp.GetNamespace("mapi");
            oSafeMailItem = new Redemption.SafeMailItem();
            String _strProfile;
            String _strPwd;
            _strProfile ="clientProfile";
            _strPwd = "*******";
            outlookNS.Logon(_strProfile, _strPwd, false, false);
            // Get items in my inbox.
            inboxFolder = outlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
            int mailItemCount;
            mailItemCount = 0;
            Response.Write("<table border=1>");
            foreach (object obj in inboxFolder.Items)
                Outlook.MailItem item = obj as Outlook.MailItem;
                if (item != null)
                    if (mailItemCount > 5)
                    oSafeMailItem.Item = item;
                    Response.Write("<td>Received: " + item.ReceivedTime.ToString() + "</td>");
                    Response.Write("<td> Sender: " + oSafeMailItem.SenderName + "</td>");
                    Response.Write("<td> Subject: " + item.Subject + "</td>");

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, mn10191b.

I need to make sure that I understand.  On the computer where this code is running you've created an Outlook profile for the testClientCare mailbox.  In your code you are logging in to that profile, yet the messages returned are from your mailbox, not this mailbox.  Is that correct?
mn10191bAuthor Commented:
Yes your understanding is correct. So I want that generic way of accessing testClientCare mail box rather than using my profile. Because that's how it should when we deploy the application.
So could you suggest solution for this scenario
David LeeCommented:
What you're doing is the correct approach.  I'm trying to figure out how the other profile can be reading your mailbox.  What happens if you open that profile manually in Outlook?  Who's mailbox do you see?
Stacy SpearPresident/Principal ConsultantCommented:
Is this C#? I see you logging in, but not connecting to the right profile. Also, you are creating all your variables before the logon, therefore wouldn't they point to the profile that was available to it then, which is the default profile.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.