Expose `op` to update custom metadata fields on items
I am trying to update some custom metadata of a sharepoint item (additional columns added, not just "name") with this package. I am able to achieve this via the mgc cli with e.g.
mgc sites lists items fields patch --list-id $listID --site-id $siteID --list-item-id 5 --body '{"metadataValue": "123"}'
With AzureGraph, following this workflow:
gr <- get_graph_login()
site <- gr$get_sharepoint_site(sp_url)
lists <- site$get_lists()[[1]]
item <- lists$get_item(5)
item$update("metadataValue" = "123")
the path that is constructed does not include the "fields" path. It appears that the op argument to do_operation() would be where this could/should be set, but this is not exposed to the outer update() function
https://github.com/Azure/AzureGraph/blob/983aaaaaa778d9e1a6de440841fced178f4ae1a4/R/ms_object.R#L81-L86
...
https://github.com/Azure/AzureGraph/blob/983aaaaaa778d9e1a6de440841fced178f4ae1a4/R/ms_object.R#L113-L117
Could this be modified to update(op="", ...) (or some other equivalent approach)? It is difficult to inject this since the class is R6, but my workaround for the moment is
field_update <- function(obj, ...) {
obj$do_operation(op = "fields", body = list(...), encode = "json", http_verb = "PATCH")
}
field_update(item, "metadataValue" = "123")