Why not install a test Ex2K box and try it out?

----- Original Message -----
From: "Gary Graham" <[EMAIL PROTECTED]>
To: "Exchange Discussions" <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 9:21 AM
Subject: Need info/help with converting code that works under CDO 1.2.1 Ex
change 5.5 to Exchange 2000


> Hello all,
>
> I hope someone has the answer to this question.  I have
> been using CDO 1.2.1 and Exchange Server 5.5 to
> programatically create Tasks in other users Outlook Task
> Folders.  I have attached a sample of the code that does
> this.  My problem is that we want to upgrade to Exchange
> Server 2000 and I have a feeling that the way I am
> currently doing this will no longer work.
>
> Here is a sample of the code I currently use:
>
>
> Const olFolderOutbox As Integer = 4
> Const olFolderSentMail As Integer = 5
> Const olFolderTasks As Integer = 13
>
> 'item types
> Const olAppointmentItem As Integer = 1
> Const olContactItem As Integer = 2
> Const olDistributionListItem As Integer = 7
> Const olJournalItem As Integer = 4
> Const olMailItem As Integer = 0
> Const olNoteItem As Integer = 5
> Const olPostItem As Integer = 6
> Const olTaskItem As Integer = 3
>
> 'task status constants
> Const olTaskComplete As Integer = 2
> Const olTaskDeferred As Integer = 4
> Const olTaskInProgress As Integer = 1
> Const olTaskNotStarted As Integer = 0
> Const olTaskWaiting As Integer = 3
>
> Const adVarNumeric As Integer = 139
> Const adCmdStoredProc As Integer = 4
> Const adInteger As Integer = 3
> Const adParamInput As Integer = 1
> Const adVarChar As Integer = 200
> Const adParamOutput As Integer = 2
> Const adParamReturnValue As Integer = 4
> Const adCmdText As Integer = 1
> Const mInput As Integer = 1
> Const mOutput As Integer = 0
> Const mAppend As Integer = 2
>
> 'global objects
> Dim MS As Object            ' the microsoft exchange object
> Dim objOutlook As Object    ' the outlook object
> Dim myNameSpace As Object   ' the Namespace object
> Dim recipientObj As Object  ' the task recipient object
> Dim f As New FileObj        ' file for debugging and error logging
> Dim recipientId             ' the recipient id
> Dim myTask As Object        ' a task object
> Dim myItem As Object        ' an item object
> Dim mapiFolder As Object
> ExchangeServer As String
>
> Private Sub Form_Load()
>
>     Dim recid
>     Dim action
>     Dim taskSubject
>     Dim taskbody
>     Dim taskDueDate
>     Dim profile
>
>     ' set the profile name
>     profile = "ggraham"
>
>     'get the name of the exchange server
>     ExchangeServer = GetSetting(appname:="OLTaskmaster",
section:="Startup",
> _
>                        Key:="ESName", Default:="issadmin1")
>
>     ' create the mapi session oject using the profile
>     Set MS = CreateObject("MAPI.Session")
>     MS.Logon , , False, True, Profileinfo:=ExchangeServer & vbLf &
> CStr(profile)
>
>
>     ' create the outlook application object
>     Set objOutlook = CreateObject("Outlook.Application")
>
>     'get the MAPI namespace and login as the user who gets the new task
>     Set myNameSpace = objOutlook.GetNamespace("MAPI")
>     myNameSpace.Logon MS.Name, , False, False
>
>
>     'get the recipient id from the mapi object
>     'and use it to get the recipient object
>     'and set the default folder to that recipient's
>     'task folder
>     recipientId = MS.CurrentUser.Id
>     Set recipientObj = myNameSpace.getRecipientFromId(recipientId)
>     Set mapiFolder = myNameSpace.getSharedDefaultFolder(recipientObj,
> olFolderTasks)
>
>
>     'create the new task object
>     Set myTask = mapiFolder.Items.Add()
>
>     taskSubject = "Test task 1"
>     taskbody = "This is a test task"
>     taskDueDate = "03/29/2002"
>
>
>     'fill in the task info
>     With myTask
>         .Body = taskBody
>         .subject = taskSubject
>         .duedate = dueDate
>     End With
>
>
>     'post the new task
>     myTask.Save
>     myTask.Close 1
>
>
>     ' clear the objects
>     Set myNameSpace = Nothing
>     Set mapiFolder = Nothing
>     Set recipientObj = Nothing
>     Set myTask = Nothing
>     Set myItem = Nothing
>
>     objOutlook.Quit
>     Set objOutlook = Nothing
>
>
> end sub
>
>
>
> I understand that the use of the Outlook Object model should continue to
> work just fine.  However I use the following code to get the ID (MS.Name)
of
> the users profile from Exchange 5.5:
>
>    ' create the mapi session oject using the profile
>     Set MS = CreateObject("MAPI.Session")
>     MS.Logon , , False, True, Profileinfo:=ExchangeServer & vbLf &
> CStr(profile)
>
>
> I then use this ID (MS.Name) to login to the Outlook Namespace. A get teh
> default folder (Task) using MS.CurrentUser.Id.  This is what allows me to
> manipulate other users Task list:
>
>    ' create the outlook application object
>     Set objOutlook = CreateObject("Outlook.Application")
>
>     'get the MAPI namespace and login as the user who gets the new task
>     Set myNameSpace = objOutlook.GetNamespace("MAPI")
>     myNameSpace.Logon MS.Name, , False, False
>
>
>     'get the recipient id from the mapi object
>     'and use it to get the recipient object
>     'and set the default folder to that recipient's
>     'task folder
>     recipientId = MS.CurrentUser.Id
>     Set recipientObj = myNameSpace.getRecipientFromId(recipientId)
>     Set mapiFolder = myNameSpace.getSharedDefaultFolder(recipientObj,
> olFolderTasks)
>
>
> My problem is that I have a feeling that I need to find another way under
> Exchange 2000 since it is not MAPI based any more.
>
> Does anyone have any Ideas???
>
>
>
> Thanks,
>
> Gary Graham
>
>
> _________________________________________________________________
> List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
> Archives:               http://www.swynk.com/sitesearch/search.asp
> To unsubscribe:         mailto:[EMAIL PROTECTED]
> Exchange List admin:    [EMAIL PROTECTED]
>

_________________________________________________________________
List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
Archives:               http://www.swynk.com/sitesearch/search.asp
To unsubscribe:         mailto:[EMAIL PROTECTED]
Exchange List admin:    [EMAIL PROTECTED]

Reply via email to