Jump to content
Sign in to follow this  
Syl21

How make M$ outlook ".UserProperties.Add" Work???

Recommended Posts

Syl21

Hello,

I need to create appointment on Outlook with a unique ID...

I have read here : http://msdn.microsoft.com/en-us/library/....interop.outlook.userproperties.add.aspx

That you can create a private field for this kind of usage.

I'm working on the WoolTown's Outlook UDF that you can find here : http://www.autoitscript.com/forum/index.php?showtopic=89321

My code seem's like this :

#include-once
#Include <Date.au3>
#Include <Array.au3>

const $sSubject = "test"
const $sUid = "1234567890"
const $sStartDate = "2010-01-27 01:00"
const $sEndDate = "2010-01-27 02:00"
const $olAppointmentItem=1
const $olSave=0

$oOutlook = ObjCreate("Outlook.Application")

Local $oNote = $oOutlook.CreateItem($olAppointmentItem)
    With $oNote
        .UserProperties.Add("Uid", "String")
    .UserProperties("Uid") = $sUid
        .Subject = $sSubject
        .Start = $sStartDate
    .End = $sEndDate
        .Save
    .Close ($olSave)
    EndWith

But the result as you can see on attached file is not what i want lol

If somebody can explain me why doesn't it work???

Thx in Advance

post-52346-12645588194784_thumb.png

Share this post


Link to post
Share on other sites
anixon

Hello,

I need to create appointment on Outlook with a unique ID...

I have read here : http://msdn.microsoft.com/en-us/library/....interop.outlook.userproperties.add.aspx

That you can create a private field for this kind of usage.

I'm working on the WoolTown's Outlook UDF that you can find here : http://www.autoitscript.com/forum/index.php?showtopic=89321

My code seem's like this :

#include-once
#Include <Date.au3>
#Include <Array.au3>

const $sSubject = "test"
const $sUid = "1234567890"
const $sStartDate = "2010-01-27 01:00"
const $sEndDate = "2010-01-27 02:00"
const $olAppointmentItem=1
const $olSave=0

$oOutlook = ObjCreate("Outlook.Application")

Local $oNote = $oOutlook.CreateItem($olAppointmentItem)
    With $oNote
        .UserProperties.Add("Uid", "String")
    .UserProperties("Uid") = $sUid
        .Subject = $sSubject
        .Start = $sStartDate
    .End = $sEndDate
        .Save
    .Close ($olSave)
    EndWith

But the result as you can see on attached file is not what i want lol

If somebody can explain me why doesn't it work???

Thx in Advance

I would get the Wooltown version to work in your environment and then modify it to see the effect that way you may well stumble on what your issue might be. I have modfied Wooltown code to my own purpose using this strategy. The other option is to see if you can make any sense of the .Net code posted in the various www.Microsoft.com forums. I also note that you have no code that checks that you have created the Outlook object I use this code Ant..

;// Create the Outlook Object

Func _sOutlookObject()

While 1

;//Create Outlook Object

$oOutlook = ObjCreate("Outlook.Application")

;//Wait for the Object to be Created

If @error Or Not IsObj($oOutlook) Then

;//Error Processing

$i = 0

While 1

$i += 1

Sleep($ObjDelay)

If IsObj($oOutlook) Then

$SysMessage = $title & " + Outlook Connected"

_MessageDisplay($sMsgDuration, $DStyleBox, $sMessageHeight, $sMsgTextJust, $SysMessage)

ExitLoop (2)

EndIf

If $i = 10 Then

$SysMessage = "Outlook ObjectCreate Error"

_MessageDisplay($sMsgDuration, $DStyleBox, $sMessageHeight, $sMsgTextJust, $SysMessage & " EXITING")

$SysMessage = $SysMessage & " EXITED"

_RecordIdProcessor(1, 3)

;//Stop Processing On Error

_sExit()

EndIf

WEnd

EndIf

ExitLoop

WEnd

Return $oOutlook

EndFunc ;==>_sOutlookObject

Edited by anixon

Share this post


Link to post
Share on other sites
Syl21

I would get the Wooltown version to work in your environment and then modify it to see the effect that way you may well stumble on what your issue might be. I have modfied Wooltown code to my own purpose using this strategy. The other option is to see if you can make any sense of the .Net code posted in the various www.Microsoft.com forums. I also note that you have no code that checks that you have created the Outlook object I use this code Ant..

;// Create the Outlook Object

Func _sOutlookObject()

While 1

;//Create Outlook Object

$oOutlook = ObjCreate("Outlook.Application")

;//Wait for the Object to be Created

If @error Or Not IsObj($oOutlook) Then

;//Error Processing

$i = 0

While 1

$i += 1

Sleep($ObjDelay)

If IsObj($oOutlook) Then

$SysMessage = $title & " + Outlook Connected"

_MessageDisplay($sMsgDuration, $DStyleBox, $sMessageHeight, $sMsgTextJust, $SysMessage)

ExitLoop (2)

EndIf

If $i = 10 Then

$SysMessage = "Outlook ObjectCreate Error"

_MessageDisplay($sMsgDuration, $DStyleBox, $sMessageHeight, $sMsgTextJust, $SysMessage & " EXITING")

$SysMessage = $SysMessage & " EXITED"

_RecordIdProcessor(1, 3)

;//Stop Processing On Error

_sExit()

EndIf

WEnd

EndIf

ExitLoop

WEnd

Return $oOutlook

EndFunc ;==>_sOutlookObject

Hello, Thanks for your answer...

I try the second solution for the moment but doesn't seem's to work... :D

The outlook appointment object creation work, if you copy past my code and just comment :

.UserProperties.Add("Uid", "String")
.UserProperties("Uid") = $sUid

you can recreate my problem...

if you can help me more...

Thx in Advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.