OfficeDev/PnP — pull request #198 by sgryphon (2014-10-09 01:27:18+00:00)
Title: Add version of UploadFile() that takes stream; Clarify parameter in GetListByUrl() and fix security

Simple addition to UploadFile() with an alternative version that takes a Stream.

Change to GetListByUrl() renames the parameter to clarify it is a web-relative URL (e.g. "Lists/Calendar")

Also the previous implementation required Web:Full Control permissions (due to accessing RootFolder for all lists in the web), which is bad security practice (to require more than necessary).

Changed to use GetList(), just creating the correct server-relative URL first (note this already ignores the casing of the URL), which only requires Read permission. Another benefit is that this is transferring less data (only for one list, rather than all of them).

Preserved the existing behaviour of which properties are retrieved (although not sure why it is retrieving those specific properties) and also by returning null when the list does not exist (rather than letting the exception bubble up).

There is one minor difference in behaviour -- the old method did a "StartsWith" match, so if you passed in "Lists/C", it would match the first list beginning with C; I think this was a bug (unintentional) in the original code. If this behaviour is required, then I suggest adding a different method with a better name, e.g. GetListStartingWithUrl(string webRelativeStartingUrl).