首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更新ItemAttachment的EWS

更新ItemAttachment的EWS
EN

Stack Overflow用户
提问于 2015-04-16 21:08:30
回答 1查看 629关注 0票数 0

我正试图消除一些TNEF在我们的PF结构中的项目的腐败现象。我遇到了一个问题,与TNEF就所附的项目。

我可以找到项目,加载它,删除属性,但我无法保存附加的项目。

我有个例外:

用"1“参数调用"Update”:“附件不支持此操作。”

代码语言:javascript
复制
$MSGID = $_
                    $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.ItemSchema]::Attachments)
                    $msMessage = [Microsoft.Exchange.WebServices.Data.EmailMessage]::Bind($exchService,$MSGID,$psPropset)
                    $msMessage.load()

                    "This message has attachments :" + $msMessage.hasattachments
                    " "|out-default

                    foreach($attach in $msMessage.Attachments){
                                "Loading attachments :"
                                $attach.Load()
                                        if ($attach.item.itemclass -eq "IPM.note")
                                            {"Found Attached email Message : Checking for TNEF Corruption on attached Message "
                                            $tnefProp1 = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x1204, [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::ShortArray)
                                            $tnefProp2 = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(0x1205, [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::ShortArray)
                                            $attach.Load($tnefProp1,$tnefProp2);

                                                    $propValue1 = $null
                                                    $propValue2 = $null
                                                    $foundProperty1 = $attach.item.TryGetProperty($tnefProp1, [ref]$propValue1)
                                                    $foundProperty2 = $attach.item.TryGetProperty($tnefProp2, [ref]$propValue2)

                                                    if ($foundProperty1 -or $foundProperty2)
                                                    {
                                                        "TNEF props found on item: " + $attach.item.Subject.ToString()

                                                        if ($Fix)
                                                        {
                                                            "    Removing TNEF properties..."

                                                            if ($foundProperty1)
                                                            {
                                                                $attach.item.RemoveExtendedProperty($tnefProp1) | Out-Null
                                                            }

                                                            if ($foundProperty2)
                                                            {
                                                                $attach.item.RemoveExtendedProperty($tnefProp2) | Out-Null
                                                            }


                                                            $attach.item.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AlwaysOverwrite)




                                                            "    Finished removing TNEF properties from this item."
                                                        }

                                                    }

                                            }
                                          else {"Attachment was not an email"}


                                 }




            $msMessage.update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AlwaysOverwrite)




        }

        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-17 13:42:38

您不能编辑附件的位置。您需要下载附件,从项目中删除它,编辑下载的副本,然后将其添加为新的附件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29686006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档