Azure / Microsoft365R

R SDK for interacting with Microsoft 365 APIs
Other
308 stars 42 forks source link

Initialize new list via site$get_list error #154

Closed monkeywithacupcake closed 1 year ago

monkeywithacupcake commented 1 year ago

The documentation on ms_list says to create a new list you use the get_list method of the site class. However, if I call site$get_lists() without a valid, existing list name or id, I get an error.

Assume that I am authenticated, and I can effectively call site$get_lists() # with no error

I expected that calling site$get_list("some new name") OR site$get_list(list_name = "some new name")

would create a new list, based on the documentation, but either it is broken, or I misunderstand. I assume the latter.

The error that I get in both cases is:

#Error in process_response(res, match.arg(http_status_handler), simplify) : 
# Not Found (HTTP 404). Failed to complete operation. Message:
# The specified list was not found
hongooi73 commented 1 year ago

You misunderstand, there is no method to create a new list. You can retrieve ONE list with get_list, or all the lists with get_lists (which should really be list_lists to be consistent with other method names, but that would sound dumb). Passing a nonexistent name to get_list will error out as you found.

monkeywithacupcake commented 1 year ago

Thanks for the clarification - I didn't think it was possible, but then I kept reading the "initialization" sections for various items, and I thought...maybe this is just a very obfuscated method.

For future people, who may have gotten too excited, like me, initialization in the code here means for your R session, not for MS365. If you use get_list() or get_site() or get_whatever() it will create an object in R of that class (list, environment, etc) not create an object on the MS365 platform.