Outlook UDF nicht vorhandene User Filtern

  • Also ich habe das nochmals alles durchgeschaut, die Werte gehen über $olCC in die _OL_ItemRecipientAdd ab da bin ich raus, komme da nicht mehr mit.


    [autoit]


    Func _OL_ItemRecipientAdd($oOL, $vItem, $sStoreID, $iType, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $bAllowUnresolved = True)

    [/autoit][autoit][/autoit][autoit]

    Local $oRecipient, $aRecipients[10], $oTempRecipient
    If Not IsNumber($iType) Then Return SetError(5, 0, 0)
    If Not IsObj($vItem) Then
    If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)
    $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
    If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move members into an array
    If Not IsArray($vP1) Then
    $aRecipients[0] = $vP1
    $aRecipients[1] = $vP2
    $aRecipients[2] = $vP3
    $aRecipients[3] = $vP4
    $aRecipients[4] = $vP5
    $aRecipients[5] = $vP6
    $aRecipients[6] = $vP7
    $aRecipients[7] = $vP8
    $aRecipients[8] = $vP9
    $aRecipients[9] = $vP10
    Else
    $aRecipients = $vP1
    EndIf
    ; add recipients to the item
    For $iIndex = 0 To UBound($aRecipients) - 1
    ; recipient is an object = recipient name already resolved
    If IsObj($aRecipients[$iIndex]) Then
    $vItem.Recipients.Add($aRecipients[$iIndex])
    If @error Then Return SetError(3, $iIndex, 0)
    Else
    If StringStripWS($aRecipients[$iIndex], 3) = "" Then ContinueLoop
    $oRecipient = $oOL.Session.CreateRecipient($aRecipients[$iIndex])
    If @error Or Not IsObj($oRecipient) Then Return SetError(600 + $iIndex, @error, 0)
    $oRecipient.Resolve
    If @error Or Not $oRecipient.Resolved Then
    If Not (StringInStr($aRecipients[$iIndex], "@")) Or Not ($bAllowUnresolved) Then Return SetError(400 + $iIndex, @error, 0)
    EndIf
    #forceref $oTempRecipient ; to prevent the AU3Check warning: $oTempRecipient: declared, but not used in func.
    $oTempRecipient = $vItem.Recipients.Add($oRecipient)
    If @error Then Return SetError(300 + $iIndex, @error, 0)
    $oTempRecipient.Type = $iType
    EndIf
    Next
    $vItem.Save()
    Return $vItem

    [/autoit][autoit][/autoit][autoit]

    EndFunc ;==>_OL_ItemRecipientAdd

    [/autoit]
  • Das ist ein Bug.
    Die Funktion muss so aussehen:

    [autoit]

    Func _OL_ItemRecipientAdd($oOL, $vItem, $sStoreID, $iType, $vP1, $vP2 = "", $vP3 = "", $vP4 = "", $vP5 = "", $vP6 = "", $vP7 = "", $vP8 = "", $vP9 = "", $vP10 = "", $bAllowUnresolved = True)

    [/autoit][autoit][/autoit][autoit]

    Local $oRecipient, $aRecipients[10], $oTempRecipient
    If Not IsNumber($iType) Then Return SetError(5, 0, 0)
    If Not IsObj($vItem) Then
    If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)
    $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
    If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move members into an array
    If Not IsArray($vP1) Then
    $aRecipients[0] = $vP1
    $aRecipients[1] = $vP2
    $aRecipients[2] = $vP3
    $aRecipients[3] = $vP4
    $aRecipients[4] = $vP5
    $aRecipients[5] = $vP6
    $aRecipients[6] = $vP7
    $aRecipients[7] = $vP8
    $aRecipients[8] = $vP9
    $aRecipients[9] = $vP10
    Else
    $aRecipients = $vP1
    EndIf
    ; add recipients to the item
    #forceref $oTempRecipient ; to prevent the AU3Check warning: $oTempRecipient: declared, but not used in func.
    For $iIndex = 0 To UBound($aRecipients) - 1
    ; recipient is an object = recipient name already resolved
    If IsObj($aRecipients[$iIndex]) Then
    $oTempRecipient = $vItem.Recipients.Add($aRecipients[$iIndex])
    If @error Then Return SetError(3, $iIndex, 0)
    $oTempRecipient.Type = $iType
    Else
    If StringStripWS($aRecipients[$iIndex], 3) = "" Then ContinueLoop
    $oRecipient = $oOL.Session.CreateRecipient($aRecipients[$iIndex])
    If @error Or Not IsObj($oRecipient) Then Return SetError(600 + $iIndex, @error, 0)
    $oRecipient.Resolve
    If @error Or Not $oRecipient.Resolved Then
    If Not (StringInStr($aRecipients[$iIndex], "@")) Or Not ($bAllowUnresolved) Then Return SetError(400 + $iIndex, @error, 0)
    EndIf
    $oTempRecipient = $vItem.Recipients.Add($oRecipient)
    If @error Then Return SetError(300 + $iIndex, @error, 0)
    $oTempRecipient.Type = $iType
    EndIf
    Next
    $vItem.Save()
    Return $vItem

    [/autoit][autoit][/autoit][autoit]

    EndFunc ;==>_OL_ItemRecipientAdd

    [/autoit]
  • Werd wohl demnächst eine neue Version rausgeben müssen :)