{"action":"created","issue":{"url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1","labels_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1/comments","events_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1/events","html_url":"https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1","id":120701320,"number":1,"title":"Sample ideas","user":{"login":"venkatkrk","id":8049615,"avatar_url":"https://avatars.githubusercontent.com/u/8049615?v=3","gravatar_id":"","url":"https://api.github.com/users/venkatkrk","html_url":"https://github.com/venkatkrk","followers_url":"https://api.github.com/users/venkatkrk/followers","following_url":"https://api.github.com/users/venkatkrk/following{/other_user}","gists_url":"https://api.github.com/users/venkatkrk/gists{/gist_id}","starred_url":"https://api.github.com/users/venkatkrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/venkatkrk/subscriptions","organizations_url":"https://api.github.com/users/venkatkrk/orgs","repos_url":"https://api.github.com/users/venkatkrk/repos","events_url":"https://api.github.com/users/venkatkrk/events{/privacy}","received_events_url":"https://api.github.com/users/venkatkrk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-07T05:21:43Z","updated_at":"2015-12-10T12:56:47Z","closed_at":null,"body":"it will be great if we can get samples of how each command could be used.\r\nFor instance, how to retrieve records using FetchXML (or) specify filtercriteria in powershell command\r\nHow to access individual record in the resultset\r\nHow to page across pages in the resultset\r\n\r\nHere is an example of my own contribution, where I wrote a simple script which would take a csv file of contactId's and mark them inactive. Hope it is of help.\r\n\r\n#Ensure CRM 2015 sdk and Microsoft.Xrm.Data.PowerShell are installed\r\n#Ensure $conn is populated by logging in using example provided here \r\n#Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\r\n#Import-Module Microsoft.Xrm.Data.PowerShell\r\n#$global:conn = Get-CrmConnection -InteractiveMode\r\n#\r\n$contactList=Import-CSV .\\contact_dupes.csv\r\nForEACH ($Contact in $contactList) {\r\n$contactid = $contact.contactId\r\n#$contactid=\"449104b5-1ed0-e411-80e7-c4346bac7958\"\r\n#Retrieve CRM Record\r\n$contactrecord = Get-CrmRecord -conn $conn -EntityLogicalName contact -id $contactid -Fields firstname,statecode\r\n#set the status code to be inactive\r\n$contactrecord.statecode=1\r\n#Update CRM Record\r\necho $contactid\r\nSet-CrmRecord -conn $conn -CrmRecord $contactrecord\r\n}"},"comment":{"url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/comments/163603429","html_url":"https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1#issuecomment-163603429","issue_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell.Samples/issues/1","id":163603429,"user":{"login":"venkatkrk","id":8049615,"avatar_url":"https://avatars.githubusercontent.com/u/8049615?v=3","gravatar_id":"","url":"https://api.github.com/users/venkatkrk","html_url":"https://github.com/venkatkrk","followers_url":"https://api.github.com/users/venkatkrk/followers","following_url":"https://api.github.com/users/venkatkrk/following{/other_user}","gists_url":"https://api.github.com/users/venkatkrk/gists{/gist_id}","starred_url":"https://api.github.com/users/venkatkrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/venkatkrk/subscriptions","organizations_url":"https://api.github.com/users/venkatkrk/orgs","repos_url":"https://api.github.com/users/venkatkrk/repos","events_url":"https://api.github.com/users/venkatkrk/events{/privacy}","received_events_url":"https://api.github.com/users/venkatkrk/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T12:56:47Z","updated_at":"2015-12-10T12:56:47Z","body":"Thanks, that was very helpful"}}