How to convert a windows user name to claims user name using PowerShell

#read the user name

$claimsUserID = read-host -prompt ‘Enter windows user name in format DOMAIN\UserName :’

#convert the user name to claims id
$claimsUserID = New-SPClaimsPrincipal -Identity $claimsUserID -IdentityType WindowsSamAccountName

$claimsUserID = $claimsUserID.ToEncodedString()

#display the claims id
write-host ‘Claims user ID is ‘ $claimsUserID

Advertisements

Nintex workflow: Extract and save InfoPath form embedded attachments into a document library

Following workflow will extract InfoPath embedded attachments and save it to a given document library in the same site collection. I have created a very simple InfoPath form to demonstrate this.

 

The below workflow supports extract single attachment or multiple attachments from the same InfoPath form. I am using Title field value to create the folder name. This can change based on the requirement.

 

Following are the detail configurations of the workflow activities. I think the above flow is self explaining and I don’t need to detail it J

Steps:

  1. Read title value from InfoPath form:

     

  2. Check whether there is a folder exists in a give document library with a name equal to title

     

  3. If the folder does not exists create the folder in the document library
  4. Get the path to the destination folder. In other words path the folder created in the above step.
  5. Extract and copy attachments from InfoPath form into folder inside document library

     

  6. This step I am writing some debug info into workflow history list.

 

This is just a quick post, so my explanations are very minimal. If you all have any questions or ideas please leave a comment.

 

Bind an “Image” column to a WPF DataGrid (XCEED)

Last week I was evaluating Xceed WPF grid & it was awesome. My objective is to connect the HR database with a nice sexy WPF application, so any employee in the company can search on other employees in style J

First you need to write a converter to convert the byte[] stream to a BitmapImage.

public
object Convert(object value, Type targetType, object parameter, CultureInfo culture)

{

 


Byte[] bytes = value as
Byte[];


MemoryStream mem = new
MemoryStream(bytes);

mem.Write(bytes, 0, bytes.Length);

mem.Seek(0, SeekOrigin.Begin);


BitmapImage image = new
BitmapImage();

 

image.BeginInit();

image.DecodePixelWidth = 60;

image.CacheOption = BitmapCacheOption.OnLoad;

image.StreamSource = mem;

image.EndInit();


return image;

 

}

 


public
object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

{

     return
null;

}

 

#endregion

}

Then do the xaml…….. That’s it. I hope I don’t have to show the code behind how to to the databind J

 

<Window x:Class=”Brandix.Employees”


xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;


xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;


xmlns:converters=”clr-namespace:Brandix”


Title=”Employees” Height=”600″ Width=”800″ xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221; Loaded=”Window_Loaded”>


<Window.Resources>


<converters:ImageConverter x:Key=”imageConverter” />


</Window.Resources>


<Grid>


<xcdg:DataGridControl Height=”160″ HorizontalAlignment=”Left” Name=”dgEmployees” VerticalAlignment=”Top” Width=”Auto” AutoCreateColumns=”False”>


<xcdg:DataGridControl.View>


<xcdg:CardflowView3D />


</xcdg:DataGridControl.View>


<xcdg:DataGridControl.Columns>


<xcdg:Column FieldName=”epic_picture” ReadOnly=”True” Title=”Picture” IsMainColumn=”True”>


<xcdg:Column.CellContentTemplate>


<DataTemplate>


<Image Source=”{xcdg:CellEditorBinding Converter={StaticResource imageConverter}}” />


</DataTemplate>


</xcdg:Column.CellContentTemplate>


</xcdg:Column>


</xcdg:DataGridControl.Columns>


</xcdg:DataGridControl>


</Grid>

</Window>

Show InfoPath forms data using XML Web Part

If you want a quick and dirty way of showing InfoPath form results in a SharePoint web part use XML Web Part.

  1. Develop the InfoPath web form.
  2. Publish it to a SharePoint list.
  3. Rename a copy of the above form as a “.cab”.
  4. Open the “cab” file using WinZip of winrar and copy the “view1.xsl”

  5. Upload the file to a list in the same SharePoint site.
  6. Add a XML web part to a page and set the properties as below.

     

    XML Link is the path to the InfoPath form results saved in the document library.

    XSL Link is the path to the XSL file we save in step 5.

     

    And the result is……..

     

     

     

    If you want further customization to the form, you can write your own XSL and set the path in the web part.

     

     

    Form with a custom XSL……