使用 UpdateListItems 添加附件?

发布于 2024-09-30 20:05:29 字数 1233 浏览 0 评论 0原文

是否可以使用 UpdateListItems 将附件添加到新列表项?

我已经尝试过这个 SOAP,但没有成功......

有人可以与我分享正确的 SOAP 结构来完成这个任务吗?

<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:UpdateListItems>
         <ns1:listName>Some Calendar</ns1:listName>
         <ns1:updates>
            <Batch OnError="Continue" ListVersion="1">
               <Method ID="1" Cmd="New">
                  <Field Name="ID">New</Field>
                  <Field Name="Title">Some Title</Field>
                  <Field Name="EventDate">2010-11-01 07:30:00</Field>
                  <Field Name="Attachments">
                     <Value Type="Attachments">/tmp/details.xml</Value>
                  </Field>
               </Method>
            </Batch>
         </ns1:updates>
      </ns1:UpdateListItems>
   </ns0:Body>
</SOAP-ENV:Envelope>

谢谢!

Is it possible to add an attachment to a new list item with UpdateListItems?

I've tried this SOAP, but no dice....

Can someone share with me the proper SOAP structure to get this done?

<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:UpdateListItems>
         <ns1:listName>Some Calendar</ns1:listName>
         <ns1:updates>
            <Batch OnError="Continue" ListVersion="1">
               <Method ID="1" Cmd="New">
                  <Field Name="ID">New</Field>
                  <Field Name="Title">Some Title</Field>
                  <Field Name="EventDate">2010-11-01 07:30:00</Field>
                  <Field Name="Attachments">
                     <Value Type="Attachments">/tmp/details.xml</Value>
                  </Field>
               </Method>
            </Batch>
         </ns1:updates>
      </ns1:UpdateListItems>
   </ns0:Body>
</SOAP-ENV:Envelope>

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小傻瓜 2024-10-07 20:05:29

找到了我的问题的答案。显然,使用 getlistitems 将文件附加到项目是不可能的。您必须在创建项目时获取 _ows_ID 值,然后对项目的 ID 值使用 AddAttachment 方法。

Found the answer to my question. Apparently, using getlistitems to attach a file to an item is not possible. You have to get the _ows_ID value when creating the item, then use the AddAttachment method on the ID value of your item.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文