<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PortalItem.update() ignores access changes - BUG? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/portalitem-update-ignores-access-changes-bug/m-p/1396317#M84014</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/697563"&gt;@ABREZN-CBreznicky&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;Unfortunately, you cannot update the access of a portal item using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#update" target="_self"&gt;PortalItem.update()&lt;/A&gt; method. We will get the documentation updated to outline the PortalItem properties that are read-only (including access).&lt;/P&gt;&lt;P&gt;When changing the sharing level of an item, you will have to use the /share endpoint since we don't have a method to update the sharing level of an item:&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/share-item-as-item-owner-.htm" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/share-item-as-item-owner-.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a small example showing how &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest" target="_self"&gt;esriRequest&lt;/A&gt; can be used to update the sharing level of an item:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/qBwaYpO?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/qBwaYpO?editors=1000&lt;/A&gt;&amp;nbsp;Only the query string in the PortalQueryParameters should need to be changed to the get the items you are looking for.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2024 21:11:44 GMT</pubDate>
    <dc:creator>LaurenBoyd</dc:creator>
    <dc:date>2024-03-14T21:11:44Z</dc:date>
    <item>
      <title>PortalItem.update() ignores access changes - BUG?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/portalitem-update-ignores-access-changes-bug/m-p/1394831#M83974</link>
      <description>&lt;P&gt;working with feature services in arcgis online.&lt;/P&gt;&lt;P&gt;i am using the ESRI JS SDK via esm npm package installed:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"@arcgis/core": "^4.29.2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i pull a list of PortalItems via PortalQueryParams:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; import PortalQueryParams from '@arcgis/core/portal/PortalQueryParams'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then for any given item from the list, i can update it's metadata properties just fine (description, accessInformation, snippet, etc.) but when i change the "access" property, it gets ignored.&lt;/P&gt;&lt;P&gt;looking at the network request, clearly the "access" property is dropped by the .update() method since it is not present in the Form Data.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3fe53c55-2f03-4647-8dca-da6286876d5b.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97751iA03C37B28D44C93B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3fe53c55-2f03-4647-8dca-da6286876d5b.jpg" alt="3fe53c55-2f03-4647-8dca-da6286876d5b.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i have dove into the PortalItem .update method source code and can see where "access" is ignored when building the request form data. specifically, .update() calls a createPostQuery function, which then runs a function this.toJSON which does not include the "access" property.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="9507ee33-ce14-438f-baa5-35532361530a.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97752i881CD8FDEDE5D397/image-size/medium?v=v2&amp;amp;px=400" role="button" title="9507ee33-ce14-438f-baa5-35532361530a.jpg" alt="9507ee33-ce14-438f-baa5-35532361530a.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have wasted hours... exploring this source code and these objects trying to figure out why it is getting ignored, and if an alternative method is required to update the sharing access that is not documented. i have had no luck. this is extremely frustrating because it&amp;nbsp;&lt;EM&gt;should&lt;/EM&gt; be as easy as changing the value for access. ESPECIALLY when the documentation indicates that it is possible:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#update" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#update&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#access" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#access&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The access property is NOT read-only like others are!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="f0978bcb-8bd3-4133-8eba-3f8b1da098ff.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97753i8C667EB6562EF302/image-size/medium?v=v2&amp;amp;px=400" role="button" title="f0978bcb-8bd3-4133-8eba-3f8b1da098ff.jpg" alt="f0978bcb-8bd3-4133-8eba-3f8b1da098ff.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;any help with this would be extremely appreciated!&lt;/P&gt;&lt;P&gt;i see the capabilities to accomplish this using the REST api but it seems ridiculous to me that such a simple change would require a whole separate set of requests when i am already authenticated and updating the&amp;nbsp;portal item.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 18:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/portalitem-update-ignores-access-changes-bug/m-p/1394831#M83974</guid>
      <dc:creator>ABREZN-CBreznicky</dc:creator>
      <dc:date>2024-03-12T18:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: PortalItem.update() ignores access changes - BUG?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/portalitem-update-ignores-access-changes-bug/m-p/1396317#M84014</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/697563"&gt;@ABREZN-CBreznicky&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;Unfortunately, you cannot update the access of a portal item using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#update" target="_self"&gt;PortalItem.update()&lt;/A&gt; method. We will get the documentation updated to outline the PortalItem properties that are read-only (including access).&lt;/P&gt;&lt;P&gt;When changing the sharing level of an item, you will have to use the /share endpoint since we don't have a method to update the sharing level of an item:&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/share-item-as-item-owner-.htm" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/share-item-as-item-owner-.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a small example showing how &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest" target="_self"&gt;esriRequest&lt;/A&gt; can be used to update the sharing level of an item:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/qBwaYpO?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/qBwaYpO?editors=1000&lt;/A&gt;&amp;nbsp;Only the query string in the PortalQueryParameters should need to be changed to the get the items you are looking for.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 21:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/portalitem-update-ignores-access-changes-bug/m-p/1396317#M84014</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2024-03-14T21:11:44Z</dc:date>
    </item>
  </channel>
</rss>

