MCPcopy Index your code
hub / github.com/O365/python-o365 / update

Method update

O365/planner.py:759–790  ·  view source on GitHub ↗

Updates this plan :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool

(self, **kwargs)

Source from the content-addressed store, hash-verified

757 **{self._cloud_data_key: bucket})
758
759 def update(self, **kwargs):
760 """ Updates this plan
761
762 :param kwargs: all the properties to be updated.
763 :return: Success / Failure
764 :rtype: bool
765 """
766 if not self.object_id:
767 return False
768
769 url = self.build_url(
770 self._endpoints.get('plan').format(id=self.object_id))
771
772 data = {self._cc(key): value for key, value in kwargs.items() if
773 key in ('title')}
774 if not data:
775 return False
776
777 response = self.con.patch(url, data=data, headers={'If-Match': self._etag, 'Prefer': 'return=representation'})
778 if not response:
779 return False
780
781 new_data = response.json()
782
783 for key in data:
784 value = new_data.get(key, None)
785 if value is not None:
786 setattr(self, self.protocol.to_api_case(key), value)
787
788 self._etag = new_data.get('@odata.etag')
789
790 return True
791
792 def delete(self):
793 """ Deletes this plan

Callers

nothing calls this directly

Calls 6

build_urlMethod · 0.80
_ccMethod · 0.80
jsonMethod · 0.80
to_api_caseMethod · 0.80
getMethod · 0.45
patchMethod · 0.45

Tested by

no test coverage detected