Guest User

Untitled

a guest
Mar 31st, 2017
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-Type -Path "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.dll"
  2. Add-Type -Path "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client.Runtime\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Runtime.dll"
  3.  
  4.  
  5.  
  6. $webUrl = "https://noteworthy.sharepoint.com/sites/USPTODSBDeployment/"
  7. $listName = "DSBUserAssetInformation"
  8. $username = "XXXXXXXXXX"
  9. $password = Read-Host -Prompt "Enter your Password" -AsSecureString
  10. $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
  11. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
  12. $ctx.Credentials = $credentials
  13. #$currentParent = ''
  14. $web = $ctx.Web
  15. $ctx.Load($web)
  16. $ctx.Load($ctx.Web.Lists)
  17. $ctx.ExecuteQuery()
  18. $list = $ctx.Web.Lists.GetByTitle("DSBUserAssetInformation")
  19. $ctx.Load($list)
  20.  
  21. $listItemInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
  22. $item = $list.AddItem($listItemInfo)
  23. $item["Title"] ="Test1"
  24. $item["ASSETID"] ="Test1"
  25. $item["ITSM_ORGANIZATION"] ="Test1"
  26. $item["PAO"] ="Test1"
  27. $item["PC"] ="Test1"
  28. $item["ASSET_EMPL_ID"] ="Test1"
  29. $item["PTO_LOGIN_ID"] ="Test1"
  30. $item["ORGANIZATION_NUMBER"] ="Test1"
  31. $item["PHONE_NUMBER_BUSINESS"] ="Test1"
  32. $item["OPERATIONAL_STATUS"] ="Test1"
  33. $item["SITEGROUP"] ="Test1"
  34. $item["SITE"] ="Test1"
  35. $item["SUITE"] ="Test1"
  36. $item["FLOOR"] ="Test1"
  37. $item["ROOM"] ="Test1"
  38. $item["DEVICE_NAME"] ="Test1"
  39. $item["ASSET_DESCRIPTION"] ="Test1"
  40. $item["WORK_STATION_ID"] ="Test1"
  41. $item["TAGNUMBER"] ="Test1"
  42. $item["SERIALNUMBER"] ="Test1"
  43. $item["AQUISTION_DATE"] ="8/4/15 12:00 AM"
  44. $item["ASSET_COMMENT"] ="Test1"
  45. $item["CATEGORY"] ="Test1"
  46. $item["CATEGORYTYPE"] ="Test1"
  47. $item["CATEGORYITEM"] ="Test1"
  48. $item["MODELVERSION"] ="Test1"
  49. $item["INSTALLDATE"] ="3/12/2016"
  50. $item["TELEWORK_PROGRAM"] ="Test1"
  51. $item["REMOTE_ACCESS_STATUS"] ="Test1"
  52. $item["CRP"] ="Test1"
  53. $item["AssetUserFirstName"] = "Test"
  54. $item["AssetUserLastName"] = "User"
  55. $item.Update()
  56. $ctx.ExecuteQuery()
Add Comment
Please, Sign In to add comment