Sunday, January 26, 2014

Merge Two List

How to Link Two Lists and Create a Combined View in SharePoint 2010




Item is currently unrated. Press SHIFT+ENTER to rate this item.1 star selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+ESCAPE to leave rating submit mode.2 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.3 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.4 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.5 stars selected. Press SHIFT+ENTER to submit. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.


Categories:SharePoint Designer; Libraries and Lists; Views; Site Manager/Power User; MOSS; WSS; 2010



You may also be interested in: the only cloud-based Dev/Test solution for SharePoint by CloudShare


Editor's note: Contributor Melick Rajee Baranasooriya is a Senior Software Engineer at IronOne Technologies. Follow him @MelickRajee
The following steps will allow you to join multiple listd together and create a combined view. For example, assume that you are managing a list for some events. You also have a separate participants list. Now you want to join the two lists and create a composite view.
SharePoint 2010 allows you to create this kind of view using Linked Data Source. With this approach you can create your own custom list in SharePoint.

How to Create a Linked Data source

Go to SharePoint Designer and go to the link called data sources.
2012-05-10-CombineView-01.png
Click the Linked Data Source button in the ribbon. SharePoint designer will prompt the following dialog.
Add the two lists that you want linked together.
2012-05-10-CombineView-02.png
2012-05-10-CombineView-03.png
I'm adding airline schedule and booking list. These are the two lists that I want to merge. Click next and it will guide you to another screen. You will be asked to select either
  • Merge
    • Merge is used to combine lists which have the same column definitions. For example we can say this is like a Union operation in the database.
  • Join
    • Join operation is used to link two or more lists. The lists do not need to have the same column definition. This is equal to join operation in the database.
I need to join the two lists to get the passengers for a particular schedule. I will use the join option and click finish.
2012-05-10-CombineView-04.png
Then switch to the general tab and give a name to identify the data source.
2012-05-10-CombineView-05.png
Now you are done with the linked data source.

How to create a custom view using linked data source in the SharePoint designer

I'm going to create a custom aspx in SharePoint Designer and create a view for it. Go to Site Pages and create new aspx file.
2012-05-10-CombineView-06.png
In Designer you can now see an empty aspc file.
2012-05-10-CombineView-07.png
You can now add the data source into the page. There are many ways to do this. The best choice is to Insert and then select your data source to add to the page. I've found that it is not always visible in the data source task pane so you you will have to go to Data View and add your data source.
2012-05-10-CombineView-08.png
This action will generate a table in the page. But we don't need it so we'll delete it. We will want the data source in the data source task pane. (Select all and press delete on the key board.)
2012-05-10-CombineView-09.png
Go to the task data source pane and select the columns you want to add to the page. Click add as a multiple view item.
style="text-align: center">2012-05-10-CombineView-10.png
This will generate a table for you. Click the right most column, go to table and add a new column to the right as seen below.
2012-05-10-CombineView-11.png
Now, place the mouse cursor to the column and select the second list in the data source pane and select the columns you want and click Join Sub View.
2012-05-10-CombineView-12.png
Then it will ask for the relation between columns to Join (like foreign key). Here link data using ID of the Airline Schedule.
2012-05-10-CombineView-13.png
Note: Sometimes the Join Sub view will not appear. In order to see it, click two or more columns. I don't know why this occurs but it has happened to me several times. And this is how I managed to solve the problem.
Now you can see a composite list view in the page that you can use for ...
2012-05-10-CombineView-14.png

Create a Silverlight APP

http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2011/08/10/sharepoint-2010-cookbook-using-silverlight-client-object-model-in-sharepoint-2010-to-create-a-silverlight-web-part.aspx

with SharePoint 2010, the Client Object Mode helps developers design client applications that access SharePoint content without installing code on the server. The Client Object Model can run directly on client machines without having been installed on the SharePoint server.
An article on MSDN tells us that the SharePoint 2010 Client Object Model supports "three new client APIs for interacting with Sharepoint sites: from a .NET managed application, from a Microsoft Silverlight application, or from ECMAScript (JavaScript, JScript) that executes in the browser." In this post, we will explore and utilize the Silverlight Client Object Model.

Challenge:


How can I use the Silverlight Client Object Model to create a Silverlight Web Part to retrieve all list items, and display the returned list data in the Silverlight DataGrid?

SharePoint 2010 Silverlight Client Object Model


The  table below lists some Client-side classes and server-side equivalents and, as you can see, it looks like the SharePoint Object Model. As a result, developers find it easy to manage and write code.


Client
Server
ClientContext SPContext
Site SPSite
Web SPWeb
List SPList
ListItem SPListItem
Field SPField
ListItemCollection SPListItemCollection
View SPView



Solution:


First, we must create a custom list named Profiles in our site collection, structured as shown in the following table:


Column Name
Type
FirstName Single line of text
LastName Single line of text
Age Number (1, 1.0, 100)
Available Yes/No (check box)



Now, we begin creating the solution using the following steps:

1. Start Microsoft Visual Studio 2010.

2. On the File menu, point to New, and then click Project.

3. In the New Project dialog box, in the Installed Template pane, expand Visual C#, and then click Silverlight.

4. In the list of templates, click Silverlight Application.





5. In the Name box, type the name that you want to use for your project, such as SPClientOMDemo.

6. In the Location box, type the location where you want to place the solution, then click OK.

7. The New Silverlight Application dialog box appears as shown in the following illustration:





8. Uncheck the Host the Silverlight application in a new Web site check box.

9. Click the OK button to create the Silverlight Application.

10. Add the reference of SharePoint client object model by right-clicking on the SPClientOMDemo project, and then clicking Add Reference... to open the Add Reference dialog box.

11. Select the Browse tab, navigate to the location of the Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll (They can be found at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin"). Select both DLLs, and then click OK as shown in the following illustration:





12. After you have added all references, the solution should look like this:





13. Using SharePoint Designer, open the Silverlight page (an XAML file) and drag and drop the DataGrid into the page:





Finally, the MainPage.xaml file will have contents that look like this:

<UserControl x:Class="SPClientOMDemo.MainPage"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 

mc:Ignorable="d" 

d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"> 


<Grid x:Name="LayoutRoot" Background="White"> 

<sdk:DataGrid AutoGenerateColumns="True" Height="300" 
HorizontalAlignment="Left" Name="grdData" 
VerticalAlignment="Top" Width="400" 
/> 

</Grid> 

</UserControl> 




14. Add a class named Profile to our project. This class will represent the SharePoint list that we are going to display in DataGrid. The Profile.cs file has the following contents:

1: namespace SPClientOMDemo

2: { 

3: public class Profile 

4: { 

5: public int ProfileID 
{ get; set; } 

6: public string 
FisrtName { get; set; } 

7: public string 
LastName { get; set; } 

8: public int Age { get; 
set; } 

9: public bool Available 
{ get; set; } 

10: } 

11: } 




15. Open the MainPage.xaml.cs file and add the reference.

Using Microsoft.SharePoint.Client, here is the MainPage.Xaml.cs file code:

1: using System;

2: using 
System.Collections.Generic; 

3: using System.Net; 

4: using System.Windows; 

5: using 
System.Windows.Controls; 

6: using 
System.Windows.Shapes; 

7: using 
Microsoft.SharePoint.Client; 

8: 

9: namespace 
SPClientOMDemo 

10: { 

11: public partial 
class MainPage : UserControl 

12: { 

13: private delegate 
void DataBindMethod(); 

14: private 
ListItemCollection collListItem; 

15: 

16: public MainPage() 

17: { 

18: 
InitializeComponent(); 

19: 

20: ClientContext 
clientContext = new ClientContext(ApplicationContext.Current.Url); 

21: Web web = 
clientContext.Web; 

22: List listProfiles = 
web.Lists.GetByTitle("Profiles"); 

23: 

24: //retrieve the 
items from the list 

25: CamlQuery query = 
new CamlQuery(); 

26: query.ViewXml = 
"<View><RowLimit>100</RowLimit></View>"; 

27: collListItem = 
listProfiles.GetItems(query); 

28: 

29: //load the returned 
items of the list in context 

30: 
clientContext.Load(collListItem); 

31: 

32: //execute the query 
asynchronously 

33: 
clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed); 

34: } 

35: private void 
onQueryFailed(object sender, ClientRequestFailedEventArgs args) 

36: { 

37: 
MessageBox.Show("Request failed. " + args.Message + "\nStack trace : " + 
args.StackTrace); 

38: } 

39: private void 
onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args) 

40: { 

41: DataBindMethod 
dataBind = DataBind; 

42: 
this.Dispatcher.BeginInvoke(dataBind); 

43: } 

44: private void 
DataBind() 

45: { 

46: List<Profile> 
profiles = new List<Profile>(); 

47: 

48: foreach (ListItem 
lstItem in collListItem) 

49: { 

50: profiles.Add(new 
Profile() 

51: { 

52: ProfileID = 
Convert.ToInt32(lstItem["ID"].ToString()), 

53: FisrtName = 
lstItem["FirstName"].ToString(), 

54: LastName = 
lstItem["LastName"].ToString(), 

55: Age = 
Convert.ToInt32(lstItem["Age"].ToString()), 

56: Available = 
Convert.ToBoolean(lstItem["Available"].ToString()) 

57: }); 

58: } 

59: 

60: grdData.ItemsSource 
= profiles; 

61: } 

62: } 

63: } 




Now that we have completed our solution, you can see that it's very simple, right? In the above code, there's just one point that we should take an additional interest in, namely:

clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);

By way of explanation, I'm going to quote the following text from an MSDN article on Using the Silverlight Object Model:

"Because query execution is asynchronous when you use the SharePoint Foundation Silverlight object model, you must pass delegates for callback methods as parameters in the ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) method, similarly to query execution in the JavaScript object model. However, to run code that makes changes in the user interface (UI) through the Silverlight object model, you must delegate this work to the Dispatcher object of the thread that created the UI by calling BeginInvoke()."

Deploy and Test:


We have two ways to deploy the Silverlight application package file (.xap) to the SharePoint environment:

  • We can use a SharePoint document library and upload the Silverlight aplication package (.xap) file there. Refer to this file's path location in the document library while adding the Silverlight Web Part; or
  • We can use SharePoint's default location [\Templates\Layouts\ClientBin] and deploy the Silverlight application package (.xap) file there. Refer to this file path from the Silverlight Web Part.

In this post, we will use the second method to deploy and test.

1. Right-click on the project and navigate to the Build tab and set the output path to the following folder:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin



2. Build the project by right-clicking the SPClientOMDemo project in Solution Explore and then selecting Build.

3. On our site collection, select the Page tab, then click Edit Page:





4. Click the Add a Web Part hyperlink:





5. On the Category pane, click Media and Content, select Silverlight Web Part on the Web Parts pane, and then click Add:
:


6. The Silverlight Web Part dialog box will be displayed, and we will input the URL of the Silverlight aplication package file (.xap). In our example, we will input the following url : /_layouts/ClientBin/SPClientOMDemo.xap





7. And finally, we will see the result:





Debugging:


To debug a Silverlight application, you must create a SharePoint project and use it to deploy a Silverlight Web Part. As a reference, see How to: Use a SharePoint Project to Deploy a Silverlight Application.

See also:


Custom Content Page Layout

http://www.dotnetcurry.com/showarticle.aspx?ID=638
http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2011/11/23/sharepoint-2010-cookbook-how-to-create-custom-page-layout-for-publishing-site-using-visual-studio-2010.aspx
SharePoint – Creating Page Layouts for Custom Content Types Posted by: Sumit Maitra , on 1/18/2011, in Category SharePoint
Views: 74098



Abstract: In my previous article Custom Content Types in SharePoint, I demonstrated how we can create custom content types in SharePoint. However we left one piece open where we couldn’t see the data that was entered in the list through the default content type. We had to go to List->Edit Properties to edit/update or view the values. In this article we’ll see how we can define custom page layouts for Custom Content Types in SharePoint
In my previous article Custom Content Types in SharePoint, I demonstrated how we can create custom content types in SharePoint. However we left one piece open where we couldn’t see the data that was entered in the list through the default content type. We had to go to List->Edit Properties to edit/update or view the values. In this article we’ll see how we can define custom page layouts for Custom Content Types in SharePoint. We will quickly recap the creation of a new Content Type. This time we’ll use a Publishing Content Type as the parent type and the site will be using a ‘Publishing’ site template.

Creating a Custom Publishing Content Type

This is quick recap of my previous article with one change as detailed below
1. Follow steps 1-4
2. In Step 5 where we’ve to make sure of the following under “Parent Content Type:”
a. “Select Parent content type from:” is set to ‘Publishing Content Type’
b. “Parent Content Type:” is set to ‘Page’
These two settings are important else you won’t be able to use the content type in a custom the page layout (created through SharePoint Designer).
Parent Content Type
Click OK and add the required columns to the content type as defined in Step 6 in my previous article.
You will notice a few extra columns in the default content type this time, because our content type is inheriting from “Page” Content Type. You can keep them because they are optional. Best part about the custom page layout is you can choose to show/hide the fields you want for the document.
Once we are done adding columns for our ‘Functional Specification’ the list of columns should look something like the list below.
Functional Specs
Note: It’s important for the parent site to use a Publishing Site template. Else custom page layouts cannot be created through designer.

Creating Custom Page Layout

To create a custom page layout we’ll use SharePoint Designer. It’s a freely downloadable tool from Microsoft. You can download the 32 bit version or the 64 bit version
Step 1: Start SharePoint Designer.
Step 2: Select ‘Sites’ and click on ‘Open Site’.
Sharepoint Open Site
Step 3: Give the site name and click Open. You’ll be prompted for credentials. Provide credentials of a site collection admin user.
Step 4: Under ‘Site Objects’ in the left navigation pane, select ‘Page Layouts’
Page Layouts
Step 5: Click on ‘New Page Layout’ button in the ‘Page Layouts’ ribbon. You will get a dialog asking you to select the content type. Here we will select the custom content type we created. Provide a filename in the URL Name field and a page title in the Title field. Click OK to continue.
New Page Layout
Step 6: In a few seconds, the skeleton layout page (aspx) will be created and opened in SPD. It’s a standard ASPX page. If you are not too much into web development, just consider it as a well formed xml. All you care about is putting your content in <asp:Content …></asp:Content> tags.
The thing of most interest for us is the Toolbox on the right. Expand the SharePoint Controls pane and you’ll see ‘Page Fields’ and ‘Content Fields’ section. Here you’ll see the Content Type columns we had defined have been all pulled in.
Content Type Columns
Step 7: Drag and Drop all the fields you need on the ASPX page inside the <asp:Content></asp:Content> tags. Unlike me if you are an HTML/CSS guru, here is where you get creative. In the end, the page should have all the content type fields you need and at a very minimum it will be good to include all the mandatory ones. My best effort looks as follows:
ASP Content Tags
Note: Observe when you drop the fields you have GUID only for the FieldName, so you better label them either before or immediately after you’ve dropped the field, else you’ll forget which field you dropped.
Step 8: Save the page (trusty old Ctrl+S) and switch to the ‘Page Layouts’ tab. Here you’ll see the ‘FunctionalSpectLayout.aspx’ has a checkmark against its name.
Page Layout Tab
Step 9: Right click on ‘FunctionalSpecLayout.aspx’ and select ‘Check In’. You will be prompted with a dialog as follows:
Check In
Make sure you select ‘Publish a major version’ because this is our first publish. Click OK.
Step 10: Clicking on OK will give you the following prompt
Content Approval
Click on ‘Yes’ and wait for SPD to start your default browser. If asked for credentials provide credentials for a Site Collection Admin. A page similar to the following will open up.
Sharepoint Designer
Step 10: Pull down the menu for the ‘FunctionalSpecLayout.aspx’ by click on the down arrow. Select ‘Approve/Reject’ from the menu.
Approve Reject
Step 11: It will pop-up a window with the following options. Select Approved, provide comments and hit OK.
Approve Status
Our Custom layout is all but done. Now, let us test it out.
Step 12: Select ‘Site Actions’ > ’Site Settings’. Under ‘Site Administration’ select ‘Site Libraries and Lists’. Click on ‘Customize “Pages”’ link. It will take us to the Page Library settings (shown below) where we’ll add our content type as one of the supported content types.
Page Library Settings
Step 13: Click on ‘Add from existing site content types’ to add our custom content type.
Add Existing Site Content Type
Step 14: In the Above screen select our custom content type ‘Functional Specifications Content Type’ and ‘Add’ it to the ‘Content Types to add’ list. Click OK.
Step 15: Click on ‘Change new button order and default content type’ to disable rest of the templates.
Change New Button Order
Click on the ‘Title, description and navigation’ select ‘Yes’ for visibility in quick launch.
That’s about it. We are all set to test our custom page layout for our very own content type.
Custom Page Layout
Step 16: In the quick launch bar on the left, click on Pages to go the page library. You’ll see a page called default. Ignore this.
Default Page
Click on Documents ribbon and Select ‘New Document’.
Step 17: You’ll be presented with Create new page screen. Fill in the ‘Title’ and ‘Description’. Change ‘URL Name’ if required.
Keep the Page Layout as functional specifications…
Click Create.
Create New Pages screen
Step 19: You will navigate back to the Page library and our first functional spec will be ready for editing
First Functional Spec
Step 20: Click on the Name to see the custom page layout.
Custom PageLayout Preview
Ooohh so pretty!!!! (mimicking my 4 year old)
Now as you see SharePoint is saying the page is checked out and editable. Then why are all the controls read-only? One last step to go.
Step 21: Select the Page ribbon and click on Edit button.
Page Ribbon Edit
OMG where did my pretty page go! Well, we forgot to tell SharePoint not to display labels for the fields in our page layout. But we will ignore that for a moment and wonder at SharePoint’s versatility.
See how the Contacts have picker controls; Dropdowns come in for Choice and Rich text editors (that can pretty much do all the formatting you can do in Word) for Rich HTML fields. All this and “look mama no code”!

No Coed Custom Layout

Disabling Content Type Field Labels in Edit Mode

We saw in Step 21 above how in Edit mode our custom page had duplicate labels. One provided by us in the layout page and another that corresponded to the Field Name of the Content Type. Ideally we would want complete control on our layout so we would like to hide the Column Name that comes automatically. To do this we go back to SharePoint designer and do the following steps.
Step 1: Select FunctionalSpecLayout.aspx from the Page Layouts folder and click on Edit. Say ‘Yes’ for all popups.
Step 2: For each field that we dropped add an attribute DisableInputFieldLabel with value ‘true’.
Disable Input Field Label
Step 3: Once all fields have been updated with the new attribute, Save the file.
Step 4: Click on ‘Page Layouts’ in the left pane. On the right pane, select ‘FunctionalSpecLayout.aspx’.
Step 5: In check-in confirmation dialog, check it in as a minor version.
Step 6: Navigate back to the Page library and edit the page. Confirm that the duplicate labels are now gone.

Conclusion

In this article we saw how a publishing site can be used to create custom content type and then define a custom page layout for the content type. So far we’ve not written a single line of code for all this work.
Next step in our learning process is to use the SharePoint workflow to take our document through an approval process. Even more interesting is development of a SharePoint feature that will convert this editable page into a non-editable document of record.










VERSION 2

SharePoint 2010 – Create Page Layout based on a custom Content Type in Visual Studio 2010


I will describe how I created a Page Layout based on a custom Content Type with SharePoint 2010 (beta2).

Content Type

First thing to do is to define a content type.
I will call my Content Type: PicturePageContentType
To do this:
- Go to: Site Settings –> Site content types
- Next, click Create

In the following screen you insert information about the content type.
An import thing to do is let it inherit from the right parent content type.
This needs to be from the group: Publishing Content Types and the parent needs to be Page.

So far nothing special, next I added some non existing columns.
On the following page click Add from new site column.

Define in the screen the follows up the columns that you would like to add to the your content type (Page Layout in the end).

After you added all the columns you needed you can overview it when you’re looking at you content type. You’ll see that I added Page Content, this was one from the already existing site columns.
 
Note: If you added a from column to your page you cannot delete it:) If you want to get rid of it you need to delete the whole content type.


Create the Page Layout

In this part I’m using Visual Studio for this. It’s not the most common way to do it but I want to stay in control of my own files without uploading/approving etc. it in the web browser.
You can do it trough the browser by going to Master pages and page layouts in Site Settings.
Then add a new Page Layout based on the content type, but I’m doing it the hard way.
First of all if you going to do this in Visual Studio you’ll need this extension:
http://visualstudiogallery.msdn.microsoft.com/en-us/990bd0c8-a55b-4643-a35d-88136594c3d9
Now create a SharePoint Project in Visual Studio.
In the Server Explorer you’ll see your SharePoint Connections, then browse al the way to your Content Type you just created.
Right click on it –> Create Page Layout

Note: This option will only be available if you installed the extension. This option will be disabled if you didn’t selected Page as parent of your Content Type.
Keep this file open we’ll save it after we created a Module.
Right click on you SharePoint project –> Add –> New Item –> SharePoint 2010 –> Module
I called the Module: PageLayoutModule
Delete the Sample.txt from the module.
Now save the Page Layout file into the Module, this is a bit strange. To save it to the Module you just created navigate in your save window to your project directory on your local disk and then save it in the Module directory. Now it’s not visible yet in your solution so navigate to the directory again but this time in your Windows Explorer. Right click on your pagelayout.aspx file –> Copy. Finally right click on your Module in the Solution Explorer –> Paste.
Note: If someone knows a more handy way to do this please tell me.

Elements.xml

To deploy everything right there need to be some information added to the Elements.xml.
First thing is to edit it like this (except the filename):
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="PageLayoutModule" Url="_catalogs/masterpage">
    <File Path="PageLayoutModule\Picturepagecontenttype.aspx" Url="Picturepagecontenttype.aspx" Type="GhostableInLibrary">
      
    </File>
  </Module>
</Elements>
The following step is to add some properties to the File. These properties are:
<Property Name="Title" Value="Page Layout with picture" />
<Property Name="MasterPageDescription" Value="Page Layout with picture" />
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
<Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png" />
<Property Name="PublishingAssociatedContentType" Value=";#PicturePageContentType;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F200                                                                   7948130EC3DB064584E219954237AF3900A2F715DA6BDAD944B8D20AFA28B7980E;#" />
The Property PublishingAssociatedContentType needs special attention.
The first one (bold) is the name of the Content Type in my case: PicturePageContentType
The second one (bold and underlined) is the Content Type ID.
To get the Content Type ID you can right click on the Content Type in the Server Explorer and then click Properties. In the properties window that popups you can find the the Content Type ID.
Now that we have our Content Type ID we can fill it in into the property value. Your Elements.xml should look something like this.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="PageLayoutModule" Url="_catalogs/masterpage">
    <File Path="PageLayoutModule\Picturepagecontenttype.aspx" Url="Picturepagecontenttype.aspx" Type="GhostableInLibrary">
      <Property Name="Title" Value="Page Layout with picture" />
      <Property Name="MasterPageDescription" Value="Page Layout with picture" />
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
      <Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/WelcomeSplash.png" />
      <Property Name="PublishingAssociatedContentType" Value=";#PicturePageContentType;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F200
                                                                   7948130EC3DB064584E219954237AF3900C10F04A5A63B6E40B4347CDDAF7A0585;#" />      
    </File>
  </Module>
</Elements>


Deploy

The only thing left to do is to deploy it.