Jump to content
visler

Deleting appointment in outlook

Recommended Posts

visler

Hi all

I been using autoit some years ago and needed a tool for changing various in outlook so i found autoit again and i allready succeed in some of this, but i cant find and delete an appointment.

I have found this example and the creation is ok (after i changed $oOL/$oOutlook typo)

Https://www.autoitscript.com/wiki/OutlookEX_UDF_-_Meeting_Item

But i cant get the delete part to work and i keep on getting "not found" and an empty array (screen shoot of _ArrayDisplay attached)

Please can someone tell me what i am missing, i have been searching and trying various but stil i have no luck in finding any items.

I am using outloook 2013 and office365. I have been able to send mails and create appointment, so i guess my problem is not due to the use off office365.


 

ScreenHunter_1774 Nov. 02 08.06.jpg

Share this post


Link to post
Share on other sites
water

I fixed the typos in the wiki.

Can you please post the code you use to create and delete the appointment?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
visler

I have tried various thing, but using the examples creates a meeting ok, but the deleting example does not work for me

 

"#include <OutlookEx.au3>
; Open the connection to Outlook
Global $oOL = _OL_Open()
; Get the appointment you want to cancel
$aResult = _OL_ItemFind($oOL, "*\Calendar", "", "[Subject]='Meeting'", "", "", "EntryID")
_ArrayDisplay
$oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")
; Send the meeting request
_OL_ItemSend($oOL, $oItem)

Edited by visler

Share this post


Link to post
Share on other sites
water

What is the value of @error and @extended after calling _OL_ItemModify and _OL_ItemSend?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
visler

I have updated the code to display error codes and screenshoot attached

"#include <OutlookEx.au3>
; Open the connection to Outlook
Global $oOL = _OL_Open()
; Get the appointment you want to cancel
$aResult = _OL_ItemFind($oOL, "*\Calendar", "", "[Subject]='Meeting'", "", "", "EntryID")
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
;
$oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
; Send the meeting request
_OL_ItemSend($oOL, $oItem)

ScreenHunter_1774 Nov. 02 09.45.jpg

ScreenHunter_1774 Nov. 02 09.47.jpg

Share this post


Link to post
Share on other sites
water

Please give this modified version of your script a try:

#include <OutlookEx.au3>
; Open the connection to Outlook
Global $oOL = _OL_Open()
; Get the appointment you want to cancel
$aResult = _OL_ItemFind($oOL, "*\Calendar", $olAppointment, "[Subject]='Meeting'", "", "", "EntryID,MeetingStatus")
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
_ArrayDisplay($aResult)
If $aResult[0][0] > 0 Then ; Items found
    If $aResult[1][1] = 0 Then ; Item is not a meeting, so simply delete it
        _OL_ItemDelete($oOL, $aResult[1][0])
    Else
        $oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")
        MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
        ; Send the meeting request
        _OL_ItemSend($oOL, $oItem) 
    EndIf
EndIf

If the value of MeetingStatus ($aResult[1][1]) is not 1 then you do not need to send a delete request but simply delete the item.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
visler

Now the array looks better :)

I am not sure I understand the part about deleting the item instead off sending a delete request.

if MeetingStatus ($aResult[1][1]) <> 1  then

      _OL_ItemDelete($oOL, where do i get this entryid)  
else

    $oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")

endif

 

ScreenHunter_1774 Nov. 02 10.44.jpg

ScreenHunter_1775 Nov. 02 10.44.jpg

Share this post


Link to post
Share on other sites
water

I modified my script in post #6 (note that I removed the quotes around $olAppointment).
It now distinguishes between meetings (multiple participants) and appointments (entry can only be found in your calendar).


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
visler

I have added a few displays.

#include <OutlookEx.au3>
; Open the connection to Outlook
Global $oOL = _OL_Open()
; Get the appointment you want to cancel
$aResult = _OL_ItemFind($oOL, "*\Calendar", $olAppointment, "[Subject]='Meeting'", "", "", "EntryID,MeetingStatus")
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
_ArrayDisplay($aResult)
If $aResult[0][0] > 0 Then ; Items found
    If $aResult[1][1] = 0 Then ; Item is not a meeting, so simply delete it
        _OL_ItemDelete($oOL, $aResult[1][0])
        MsgBox(48, "OutlookEX UDF: _OL_Itemdelete", "Errorcode " & @error & ", @extended: " & @extended)
    Else
        $oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")
        MsgBox(48, "OutlookEX UDF: _OL_Itemmodify", "Errorcode " & @error & ", @extended: " & @extended)
        ; Send the meeting request
        _OL_ItemSend($oOL, $oItem)
        MsgBox(48, "OutlookEX UDF: _OL_Itemsend", "Errorcode " & @error & ", @extended: " & @extended)
    EndIf
EndIf

Now the array returned look much more like i expected and all is returning 0 in errorcodes, but it looks like the appoint is not deleted and a re-run gives the same result in the array, but if i delete one of the meetings by hand the results is decreased by 1 .

 

ScreenHunter_1775 Nov. 02 12.28.jpg

ScreenHunter_1777 Nov. 02 12.32.jpg

ScreenHunter_1777 Nov. 02 12.28.jpg

ScreenHunter_1776 Nov. 02 12.28.jpg

Share this post


Link to post
Share on other sites
water

Seems you then need to delete the meeting from your calendar manually:

#include <OutlookEx.au3>
; Open the connection to Outlook
Global $oOL = _OL_Open()
; Get the appointment you want to cancel
$aResult = _OL_ItemFind($oOL, "*\Calendar", $olAppointment, "[Subject]='Meeting'", "", "", "EntryID,MeetingStatus")
MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Errorcode " & @error & ", @extended: " & @extended)
_ArrayDisplay($aResult)
If $aResult[0][0] > 0 Then ; Items found
    If $aResult[1][1] = 0 Then ; Item is not a meeting, so simply delete it
        _OL_ItemDelete($oOL, $aResult[1][0])
        MsgBox(48, "OutlookEX UDF: _OL_Itemdelete", "Errorcode " & @error & ", @extended: " & @extended)
    Else
        $oItem = _OL_ItemModify($oOL, $aResult[1][0], Default, "MeetingStatus=5")
        MsgBox(48, "OutlookEX UDF: _OL_Itemmodify", "Errorcode " & @error & ", @extended: " & @extended)
        ; Send the meeting request
        _OL_ItemSend($oOL, $oItem)
        MsgBox(48, "OutlookEX UDF: _OL_Itemsend", "Errorcode " & @error & ", @extended: " & @extended)
        _OL_ItemDelete($oOL, $oItem)
        MsgBox(48, "OutlookEX UDF: _OL_Itemdelete", "Errorcode " & @error & ", @extended: " & @extended)
    EndIf
EndIf

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
visler

:)

Now it works

Thanks a million

Share this post


Link to post
Share on other sites
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

  • Similar Content

    • Bllee
      By Bllee
      every time i press "delete button" delete a line, but i can't add new line with info. the id line write normally but i can't change or add new info
      obs: looking at the "includes" one realizes that already tried of everything that knew
      my code
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <StringConstants.au3> #include <Array.au3> #include <GuiListBox.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 612, 480, 192, 154) $MenuItem1 = GUICtrlCreateMenu("&Arquivo") $MenuItem2 = GUICtrlCreateMenuItem("Salvar Ctrl+S", $MenuItem1, $SS_CENTER) $MenuItem4 = GUICtrlCreateMenuItem("Carregar Ctrl+O", $MenuItem1, $SS_CENTER) $MenuItem3 = GUICtrlCreateMenuItem("Salvar Como Shitft+Ctrl+S", $MenuItem1, $SS_CENTER) $Group1 = GUICtrlCreateGroup("", 21, 8, 569, 97, $SS_CENTER) $Input1 = GUICtrlCreateInput("ID COR", 122, 32, 97, 21, $SS_CENTER) $Input2 = GUICtrlCreateInput("REGIÃO", 138, 64, 249, 21, $SS_CENTER) $Input3 = GUICtrlCreateInput("Label", 264, 30, 121, 21, $SS_CENTER) $Label1 = GUICtrlCreateLabel("Label", 232, 32, 30, 17, $SS_CENTER) $Button1 = GUICtrlCreateButton("Capturar Cor", 42, 30, 75, 25, $SS_CENTER) $Button2 = GUICtrlCreateButton("Capturar Região", 42, 62, 91, 25, $SS_CENTER) $Button3 = GUICtrlCreateButton("ADD", 442, 24, 113, 33) $Button5 = GUICtrlCreateButton("Delet", 442, 64, 113, 33) $Group2 = GUICtrlCreateGroup("Editar ID selecionado", 8, 384, 601, 57, $SS_CENTER) $Input7 = GUICtrlCreateInput("ID", 10, 402, 40,21, $SS_CENTER) $Input4 = GUICtrlCreateInput("COR", 51, 402, 121, 21, $SS_CENTER) $Input5 = GUICtrlCreateInput("REGIÃO", 173, 402, 249, 21, $SS_CENTER) $Input6 = GUICtrlCreateInput("LABEL", 423, 402, 121, 21, $SS_CENTER) $Button4 = GUICtrlCreateButton("\/", 544, 400, 30, 25, $SS_CENTER) $Button6 = GUICtrlCreateButton("/\", 574, 400, 30, 25, $SS_CENTER) ; Add column Global $id = Int(0) $List1 = GUICtrlCreateListView("",5, 120, 601, 253, $SS_CENTER) _GUICtrlListView_AddColumn($List1, "ID",40) _GUICtrlListView_AddColumn($List1, "COR",100) _GUICtrlListView_AddColumn($List1, "COORDENADA",305) _GUICtrlListView_AddColumn($List1, "LABEL",150) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem2 MsgBox($MB_SYSTEMMODAL, "ctrl + s", "Nothing Here",1) Case $MenuItem3 MsgBox($MB_SYSTEMMODAL, "shift+ctrl s", "Nothing Here",1) Case $MenuItem4 MsgBox($MB_SYSTEMMODAL, "ctrl + o", "Nothing Here",1) Case $Button1 MsgBox($MB_SYSTEMMODAL, "Capturar cor", "Aperte espaço para capturar a cor") GUICtrlSetData($Input1,MouseColor()) Case $Button2 MsgBox($MB_SYSTEMMODAL, "capturar região", "Aperte espaço para capturar a posição inicial") local $mouse = MouseGetPos() $x_init = $mouse[0] $y_init = $mouse[1] MsgBox($MB_SYSTEMMODAL, "capturar região", "Aperte espaço para capturar a posição final") local $mouse = MouseGetPos() $x_end = $mouse[0] $y_end = $mouse[1] GUICtrlSetData($Input2,$x_init&','&$y_init&' ; '&$x_end&','&$y_end) Case $Button3 _GUICtrlListView_AddItem($List1, $id, 1) ; id _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input1), 1, 1) ;cor _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input2), 2, 1) ;coordenada _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input3), 3, 1) ;label $id= $id + 1 Case $Button4 $Item = _GUICtrlListView_GetSelectedIndices($List1) $Sid = _GUICtrlListView_GetItem($List1, Number($Item),0) $Scor = _GUICtrlListView_GetItem($List1, Number($Item),1) $Scord = _GUICtrlListView_GetItem($List1, Number($Item),2) $Slabel = _GUICtrlListView_GetItem($List1, Number($Item),3) ; get info GUICtrlSetData($Input7,$Sid[3]) GUICtrlSetData($Input4,$Scor[3]) GUICtrlSetData($Input5,$Scord[3]) GUICtrlSetData($Input6,$Slabel[3]) Case $Button5 _GUICtrlListView_DeleteItemsSelected($List1) Case $Button6 ; give back inf if GUICtrlRead($Input7) <> "ID" Then _GUICtrlListView_SetItem($List1, GUICtrlRead($Input4), GUICtrlRead($Input7),1) ;cor _GUICtrlListView_SetItem($List1, GUICtrlRead($Input5), GUICtrlRead($Input7),2) ;coordenada _GUICtrlListView_SetItem($List1, GUICtrlRead($Input6), GUICtrlRead($Input7),3) ;coordenada EndIf EndSwitch WEnd Func MouseColor() local $mouse = MouseGetPos() Return Hex(PixelGetColor($mouse[0],$mouse[1]), 6) EndFunc  
    • Sally1801
      By Sally1801
      Hello,
      i need help in deleting files from a server. The function "_FTP_DirDelete" only deletes a directory when its empty. I need to delete a non empty directory. I also can not delete the files in this directory first, because the files are PAG and DIR files in a .DAV directory and FTPEx.au3 doesnt like a directory starting with a ".".
      Any ideas?
      Thx, Sally
    • Gowrisankar
      By Gowrisankar
      Dear members of the forum,
      I need to open the attachments from mails without downloading them. Is it possible using OutlookEx UDF ?
    • water
      By water
      Extensive library to control and manipulate Microsoft Outlook.
      Theads: Development - General Help & Support - Example Scripts - Wiki
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort

      KNOWN BUGS (last changed: 2018-01-26)
      None
    • Gowrisankar
      By Gowrisankar
      Dear members,
      I'm trying to get the attachments from mails using OutlookEx UDF and then save them in a particular location.
      The UDF considers even the signature images and other images in the mail body as attachments, and saves it in the folder I point. I want only the proper attachment documents to be saved.
      Requesting the guidance of the forum members.
       
       
      Thanks and regards,
      Gowrisankar R.
×