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

Method update

O365/drive.py:630–661  ·  view source on GitHub ↗

Updates this item :param kwargs: all the properties to be updated. only name and description are allowed at the moment. :return: Success / Failure :rtype: bool

(self, **kwargs)

Source from the content-addressed store, hash-verified

628 return data
629
630 def update(self, **kwargs):
631 """ Updates this item
632
633 :param kwargs: all the properties to be updated.
634 only name and description are allowed at the moment.
635 :return: Success / Failure
636 :rtype: bool
637 """
638 if not self.object_id:
639 return False
640
641 url = self.build_url(
642 self._endpoints.get('item').format(id=self.object_id))
643
644 data = {self._cc(key): value for key, value in kwargs.items() if
645 key in {'name',
646 'description'}} # convert keys to protocol casing
647 if not data:
648 return False
649
650 response = self.con.patch(url, data=data)
651 if not response:
652 return False
653
654 new_data = response.json()
655
656 for key in data:
657 value = new_data.get(key, None)
658 if value:
659 setattr(self, self.protocol.to_api_case(key), value)
660
661 return True
662
663 def delete(self):
664 """ Moves this item to the Recycle Bin

Callers 4

get_itemsMethod · 0.45
searchMethod · 0.45
_base_get_listMethod · 0.45
searchMethod · 0.45

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