Wednesday, November 26, 2014

WCF Service Testing Tool

If you are trying to find good tool WCF service testing . Here is free tool available which come with your Visual studio.

You can find this in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE depend on version of your VS. I have 2013 so its in 12.0 folder

File Name is WCF Test client .

This is very handy tool to test your WCF services

  1. You can right click on root and say "Add Service" and give url of WSDL. 
  2. Now Select method which you want to invoke 
  3. Fill the parameters and Click on Invoke.
  4. This will return you are output in below window.

The only issue which I can see as of now is this does not support asynchronous operations contracts.

Tuesday, November 25, 2014

Change the Team foundation credential

Today I had one tricky issue while connecting with TFS. I had configured my friends account while creating TFS workspace on my machine. When I tried to connect TFS with my credential it always taking my friend credential . After doing some research i found these credential  are cached deep in windows bowels.To clear the cache You need to type following command in Run.

Go to Advance tab and clear the credential which you are using to connect TFS.

This should solved your problem. 

Tuesday, November 18, 2014

How to update User profile using powerShell

When I was working with one of the client .I was asked to set couple of values in user profile . Here is small power shell script which will be handy when trying to edit User profile on SharePoint 2010 User profile service.
1. This will read csv file.
2. Will write output file.

# SharePoint site URL
$site = new-object Microsoft.SharePoint.SPSite("http://XXXXXX:xxxx/");  # central Admin url
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);
$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$results = @()
$filePath = "C:\Deployments\PowerShell\output.csv"
#Loop Through all Profiles and write properties where condition is met 
Import-Csv C:\Deployments\PowerShell\profile1.csv |
ForEach-Object {
try {
        $profile = $ProfileManager.GetUserProfile($_.AccountName)
        If($profile -ne $null)
        $prevValue= $profile["Flag"].Value
        If ($profile["Flag"].Value -eq $False)
            #write down to object for CSV export  
             $details = @{            
                        Account    = $AccountName             
                        PreVal     = $prevValue                 
                        NewValue   = $NewVal 
            $results += New-Object PSObject -Property $details  
    catch {
                "Exception when getting account " + $AccountName + " --> " + $error[0]
$results | export-csv -Path $filePath -NoTypeInformation

write-host "Finished."