Object cannot be created at this URL because an object named by this
am 11.01.2008 14:42:59 von DhananjayHi All,
I want to develop one application in vb.net for exchange 2000.
I tried to add one contact with the code snippet below. The same logic
is there for appointment on Microsoft's site.
(I added Microsoft CDO exchange library for 2000 & activex data object
2.5 reference to the project)
Dim sURL As String
sURL = "http://sbsserver/Exchange/trial/contacts"
Dim oCn As ADODB.Connection = New ADODB.Connection()
' For server change oCn.Provider to "exoledb.datasource";
oCn.Provider = "exoledb.datasource"
oCn.Open(sURL, "", "", 0)
If oCn.State = 1 Then
Console.WriteLine("Good Connection")
Else
Console.WriteLine("Bad Connection")
Return
End If
Dim iConfg As CDO.Configuration = New CDO.Configuration()
Dim oFields As ADODB.Fields
oFields = iConfg.Fields
oFields.Item(CDO.CdoCalendar.cdoTimeZoneIDURN).Value =
CDO.CdoTimeZoneId.cdoPacific
' TODO: Set Meeting Organizer
oFields.Item(CDO.CdoConfiguration.cdoSendEmailAddress).Value =
"organizer@example.com"
oFields.Update()
' Below is my code in which I just removed the logic of creation of
appointment with creation of contact
Dim oContact As New CDO.Person
' ***************************************
oContact.FirstName = "FirstTrial"
oContact.LastName = "LastTrial"
oContact.Configuration = iConfg
oContact.DataSource.SaveTo sURL, , _
ADODB.ConnectModeEnum.adModeReadWrite, _
ADODB.RecordCreateOptionsEnum.adCreateNonCollection, _
ADODB.RecordOpenOptionsEnum.adOpenSource, _
"", ""
oContact = Nothing
oCn.Close()
oCn = Nothing
oFields = Nothing
' ***************************************
Now here if I run the program for first time, my contact is
successfully get created in the trial's contacts folder. But if I run
this program second time, it gives me error "Object cannot be created
at this URL because an object named by this URL already exists". On
some forum, the solution to error is given as - Try to create the
contact with readWrite & Overwrite attribs. So I changed the above
creation code from
"ADODB.RecordCreateOptionsEnum.adCreateNonCollection" to
"ADODB.RecordCreateOptionsEnum.adCreateOverwrite". But it gives me the
error as "Unspecified error". So how I can create a contact or modify
existing contact in the trial's mailbox?
Further how I can create the task for Trial using similar code above?
Also please anyone point me to the right direction where I can get the
knowledge about step by step exchange programming on the internet?
Thanks in advance