Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win 2000 Terminal Server & Outlook

Status
Not open for further replies.

RoadRunnerOz

Programmer
Aug 22, 2000
128
AU
My client runs a win 2000 Terminal server network with all applications on the server. They want me to interface with Outlook to add tasks, contacts,notes etc to Outlook but to any user's profile. I have no problem accomplishing this to the online users .pst file. So, assuming I can get user rights to all profiles can I add records to other pst profiles other than the one I'm in?

If I'm not clear:

User Jim is logged in
If I create an outlook object:
createobject("Outlook.Application")

This will use Jim's profile in c:\documents and settings\jim\application data\microsoft\outlook\outlook.pst I believe. So everything I add/modify will affect just Jim only

Can I access c:\documents and settings\Jane\application data\microsoft\outlook\outlook.pst somehow?

So with Jim logged in he needs to add tasks etc to Jane's profile?

createobj("Outlook.Application","FullpathToJanesProfile?")?

They are also using MS Exchange, Visual FoxPro 7 , Outlook 2000 & Win 2000

Thanks in advance



Michael Ouellette
mouellette@compuserve.com
 
Can I access c:\documents and settings\Jane\application data\microsoft\outlook\outlook.pst somehow?

Yes you can.

OL = createobject("Outlook.Application")
NS = OL.GetNamespace('MAPI')
NS.AddStore("FullpathToJanesProfile\PstFile.pst")

I used this for my "personal folder" only. Never try for other user profiles. I guess you have to pay attention for W2K security, user permission, etc..

Hope it helps


-- AirCon --
 
I tried that on my PC to access my archive.pst file but any manipulation I tried ended up on my default pst file.

I couldn't even find .creatitem(1) to add an email.

But thanks, I'll keep trying


Michael Ouellette
mouellette@compuserve.com
 
This is how I create an item then move it to "Personal Drafts Folder"

OL = CreateObject('Outlook.Application')
NS = OL.GetNamespace('MAPI')

NS.AddStore('C:\Temp\Test.pst')
oPersonal = NS.Folders(NS.Folders.Count)
oDrafts = oPersonal.Folders.Add('Drafts')

oItem = oDrafts.Application.CreateItem(0)
With oItem
.To = 'anyone@forum.com'
.Subject = 'Test'
.Body ='Testing email from Michael Ouellette'
.Save
.Move(oDrafts)
EndWith


-- AirCon --
 
That works!
Didn't work at all with the archive.pst file. Outlook didn't like it.
After copying the archive.pst file and renaming it to test.pst I had no problems.

Now I need to remove the pstfile so the user cannot see it.
I assumed RemoveStore did the opposite to AddStore but I keep getting a "type mismatch " error with this command
ns.RemoveStore("FullPath2MyFile\Outlook\test.pst")

I used to have an outlook model that I used to look up the syntax so now I'm flying blind. I believe it was a public domain file - any idea where to get it again?

Thanks



Michael Ouellette
mouellette@compuserve.com
 
To remove the folder

ns.RemoveStore(oPersonal)

Regards

-- AirCon --
 
Thanks. - I fiddled with the syntax and found ns.RemoveStore(oDrafts) also works.

FYI: The object model I was looking for is included with outlook, DUH! I found it when attempting to create a macro.
It's VB code but good enough for me.

Thanks again for gittin' me in the right direction...






Michael Ouellette
mouellette@compuserve.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top