Monday, 1 April 2013

Create Page Layout in Sharepoint2010



STEP 1:
Open Visual Studio --> create one Empty SharePoint Project
STEP 2:


Change the sample.txt = Homepage.aspx like this
Please enter the ‘Yes’ option
Will be changed like this



Open the Homepage --> Elements.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Homepage">
    <File Path="Homepage\Sample.txt" Url="Homepage/Sample.txt" />
  </Module>
</Elements>


STEP 3:

Change the Elements.xml like this

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name=" Homepage"  List="116"  Url="_catalogs/masterpage">
<File Path="Homepage\Homepage.aspx" Url="Homepage.aspx" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary" >
</File>
</Module>
</Elements>

STEP 4:
Open your site --> click the ‘Site Action’ and Click the ‘Edit Page’

Click the Arrow mark and select ’Edit Web Part’

Goto Advanced option & choose the ‘Export all data’ and click ‘OK’ Button

Now again edit the webpart and choose the Export data
Open the file after click the Export
Now open the Elements.xml
More than Exported file means paste one by one
Note: Change the WebPartzoneID and webpartorder


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Homepage">
    <File Path="Homepage\Homepage.aspx" Url="Homepage/Homepage.aspx" />
   
<AllUsersWebPart WebPartZoneID="WPAddUser" WebPartOrder="1">
        <![CDATA[

Copy and paste the opened Export file here
  ]]>
</AllUsersWebPart>
   
<AllUsersWebPart WebPartZoneID="WpMySite" WebPartOrder="2">
        <![CDATA[

Copy and paste the opened Export file here
  ]]>
</AllUsersWebPart>
</File>
  </Module>
</Elements>


Note : In WepartzoneID both are same in Elements.xml page and Homepage.aspx page
(Elements.xml <AllUsersWebPart WebPartZoneID="WPAddUser" WebPartOrder="1"> and design page webpartzone control ID <WebPartPages:WebPartZone runat="server" Title="Add User" ID="WPAddUser"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>)
                   
STEP 5:
Open the Homepage.aspx
Design the page

For example :
<%@ Page language="C#"   Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"  %>
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
      
    <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>

</asp:Content>

<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
</asp:ScriptManagerProxy>


<style type="text/css">
.modalBackground
{   
    position: absolute;
            z-index: 100;
            top: 0px;
            left: 0px;
            background-color: #000;
            filter: alpha(opacity=60);
            -moz-opacity: 0.6;
            opacity: 0.6;
}

.wt_box{ width:35%; float:left; font-size:13px; color:Black; font-weight:bold; padding-top:12px; padding-left:1%;}
 h1{ font-family:verdana, arial, helvetica, sans-serif; color:#216eca; font-size:12px; padding:5px 1% 5px 4%;}
 h2{ font-family:verdana, arial, helvetica, sans-serif; color:#fff; font-weight:bold; text-transform:uppercase; font-size:13px;padding-left:1%;}
 h3{ font-family:verdana, arial, helvetica, sans-serif; color:#216eca; font-size:14px; padding:15px 1% 5px 6%; font-weight:bold; margin:0px;}
 h5{ font-family:verdana, arial, helvetica, sans-serif; color:#216eca; font-size:14px; padding:15px 1% 5px 6%; font-weight:bold; margin:0px;  text-transform:uppercase; }
h6{ font-family:verdana, arial, helvetica, sans-serif; color:#000; font-size:14px; padding:15px 1% 5px 6%; font-weight:bold; margin:0px;  text-transform:uppercase; }


h4{ font-family:verdana, arial, helvetica, sans-serif; color:#000; font-size:14px; padding:15px 1% 5px 6%; font-weight:bold;  margin:0px;}
h7{ font-family:verdana, arial, helvetica, sans-serif; color:#fff; font-weight:bold; text-transform:uppercase; font-size:13px;padding-left:1%; padding:0px;}

</style>


<asp:Panel ID="pnlFullPage" runat="server" DefaultButton="btnDefault">
<div class="main_box_content">
            <div class="main_box">
                <div class="main_box_left">
                </div>
                <div class="main_box_bg">
                </div>
                <div class="main_box_right">
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="main_box_bg_mid">
            <div class="info_two">
                            <div class="infogry_left"></div>
                          <div class="info_bg"> <p id="pSiteName" style="font-family:verdana, arial, helvetica, sans-serif; color:#fff; font-weight:bold;font-size:18px; vertical-align:middle;"><%= SPContext.Current.Web.Title %></p></div>
                            <div class="info_right">
                            </div>
              </div>
                <!--content  outer part open-->
              <div class="content_left">
                                      
                    <div  class="d_mysite">
                      <WebPartPages:WebPartZone runat="server" Title="Add User" ID="WPAddUser"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
                    </div>
            
                    <div  class="d_mysite">
                        <WebPartPages:WebPartZone runat="server" Title="My Links" ID="WPMysite"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
                    </div>
                          
                        </div>
                        
                        <div class="clear">
                        </div>
                    </div>
                  
                  
                </div>
                <!--content  outer part end-->
           <div class="main_box1">
                <div class="main_box_bot_left">
                </div>
                <div class="main_box_bot_bg">
                </div>
                <div class="main_box_bot_right">
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
        <asp:Button ID="btnDefault" style="display:none;" runat="server" />
</asp:Panel>
  



</asp:Content>


STEP 6:
Deploy the solution
Goto Your site and Activate the Feature

SharePoint online - Get List-item attachments and Display to div

Step 1 : Create a List ex: TestList and attach few images Step 2 : Copy and Pastet the below coding in App.js var  Items =  null ; ...