Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -Path "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.dll"
- 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"
- $webUrl = "https://noteworthy.sharepoint.com/sites/USPTODSBDeployment/"
- $listName = "DSBUserAssetInformation"
- $username = "XXXXXXXXXX"
- $password = Read-Host -Prompt "Enter your Password" -AsSecureString
- $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
- $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
- $ctx.Credentials = $credentials
- #$currentParent = ''
- $web = $ctx.Web
- $ctx.Load($web)
- $ctx.Load($ctx.Web.Lists)
- $ctx.ExecuteQuery()
- $list = $ctx.Web.Lists.GetByTitle("DSBUserAssetInformation")
- $ctx.Load($list)
- $listItemInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
- $item = $list.AddItem($listItemInfo)
- $item["Title"] ="Test1"
- $item["ASSETID"] ="Test1"
- $item["ITSM_ORGANIZATION"] ="Test1"
- $item["PAO"] ="Test1"
- $item["PC"] ="Test1"
- $item["ASSET_EMPL_ID"] ="Test1"
- $item["PTO_LOGIN_ID"] ="Test1"
- $item["ORGANIZATION_NUMBER"] ="Test1"
- $item["PHONE_NUMBER_BUSINESS"] ="Test1"
- $item["OPERATIONAL_STATUS"] ="Test1"
- $item["SITEGROUP"] ="Test1"
- $item["SITE"] ="Test1"
- $item["SUITE"] ="Test1"
- $item["FLOOR"] ="Test1"
- $item["ROOM"] ="Test1"
- $item["DEVICE_NAME"] ="Test1"
- $item["ASSET_DESCRIPTION"] ="Test1"
- $item["WORK_STATION_ID"] ="Test1"
- $item["TAGNUMBER"] ="Test1"
- $item["SERIALNUMBER"] ="Test1"
- $item["AQUISTION_DATE"] ="8/4/15 12:00 AM"
- $item["ASSET_COMMENT"] ="Test1"
- $item["CATEGORY"] ="Test1"
- $item["CATEGORYTYPE"] ="Test1"
- $item["CATEGORYITEM"] ="Test1"
- $item["MODELVERSION"] ="Test1"
- $item["INSTALLDATE"] ="3/12/2016"
- $item["TELEWORK_PROGRAM"] ="Test1"
- $item["REMOTE_ACCESS_STATUS"] ="Test1"
- $item["CRP"] ="Test1"
- $item["AssetUserFirstName"] = "Test"
- $item["AssetUserLastName"] = "User"
- $item.Update()
- $ctx.ExecuteQuery()
Add Comment
Please, Sign In to add comment