About Me

My photo
Muthupet, TamilNadu, India
SharePoint 2010

Monday, December 17, 2012

Profile Picture On Masterpage Login


1.With in Register

<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

2.with in the

<div class="s4-trc-container-menu">
   <div>
    <SPSWC:ProfilePropertyImage PropertyName="PictureUrl" style="float: left; height: 40px;" ShowPlaceholder="true" ID="PictureUrlImage" runat="server"/>
    <wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false">
   </wssuc:Welcome>
   <wssuc:MUISelector ID="IdMuiSelector" runat="server"/>
  </div>
 

Tuesday, December 4, 2012

Hyberlink using call JavaScript Function



<Columns>

        <asp:TemplateField>

            <ItemTemplate>

                <asp:LinkButton ID="lnk" runat="server" Text='<%#Eval("Title") %>' OnClientClick="javascript:return OpenDialogbox(this);"></asp:LinkButton>

                <asp:HiddenField ID="hdn" runat="server" Value='<%#Eval("ID")%>' />

            </ItemTemplate>

            <HeaderTemplate>Titel</HeaderTemplate>

        </asp:TemplateField>

 

 

<script language="javascript" type="text/javascript">

    function OpenDialogbox(obj) {

        var item = obj.id;

        item = item.replace("lnk", "hdn");

        var itemid = document.getElementById(item).value;

        alert('saravanan');

        var options = {

            url: "http://igrid108:777/_Layouts/Saravanan_Testsolutions/Edit.aspx?Itemsvalue=" + itemid,

            width: 600,

            height: 300,

            showClose: true,

            title: "Edit Notes"

        };

        SP.UI.ModalDialog.showModalDialog(options);

        return false;

    } 

</script>
 
 
Application page using javascript alert and redirect same page (refresh) script
-------------------------------------------------------------------------------
 
 
using (SPWeb oweb = osite.OpenWeb())

                {

                    SPList olist = oweb.Lists["Tasks"];

                    SPListItem oitem = olist.GetItemById(itemidvalue);

                   

                    oitem["Title"] = TextBox1.Text;

                    oweb.AllowUnsafeUpdates = true;

                    oitem.Update();

                    oweb.AllowUnsafeUpdates = false;

                    Response.Write("<script language='javascript' >alert('Details updated successfully!!'); parent.document.location.href= parent.document.location.href</script>");

 
Some Different Ways..
---------------------
 

                  //  Page.ClientScript.RegisterStartupScript(this.GetType(), "call my function", "alertmsg();", true);

                  //  ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('Item saved sucessfully');", true);

                  //  Response.Write("javascript:return alertmsg();");
}

 



 

Sunday, December 2, 2012

Bind Sharepoint 2010 List items in DropDown



using (SPSite site = new SPSite(SPContext.Current.Site.Url))

{

using (SPWeb web = site.OpenWeb())

{

SPList list = web.Lists["Employee"];

dropSite.DataSource = list.Items.GetDataTable();

dropSite.DataValueField = "Company";

dropSite.DataTextField = "Company";

dropSite.DataBind();

}

}

Wednesday, November 28, 2012

HyberLink using Sharepoint Grid




using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
namespace Saravanan_Testsolutions.Gridsamples
{
    public partial class GridsamplesUserControl : UserControl
    {
        public SPList olist { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            databind();
        }
        public void databind()
        {
            try
            {
                using(SPSite osite= new SPSite(SPContext.Current.Site.ID))
                {
                    using (SPWeb oweb = osite.OpenWeb(SPContext.Current.Web.Name))
                    {
                        olist = oweb.Lists.TryGetList("Tasks");
                        SPListItemCollection oitemcoll = olist.Items;
                        if (oitemcoll.Count > 0)
                        {
                            grdshow.DataSource = oitemcoll.GetDataTable();
                            grdshow.DataBind();
                        }
                    }
                }
            }
            catch (Exception)
            {
               
                throw;
            }
        }
        protected void grdshow_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HyperLink lnk = new HyperLink();
                lnk.Text = e.Row.Cells[0].Text;
                lnk.NavigateUrl =olist.DefaultViewUrl;
                e.Row.Cells[0].Controls.Add((Control)lnk);
            }
        }
    }
}

Friday, November 23, 2012

Available Field Types in SharePoint 2010




Out of the box Field Types




NameUse
AllDayEvent
Attachments
Boolean
BusinessData
Calculated
Choice
Computed
ContentTypeId
Counter
CrossProjectLink
Currency
DateTime
Decimal
File
GridChoice
Guid
Integer
Lookup
LookupMulti
ModStat
MultiChoice
MultiColumn
Note
Number
PageSeperator
Recurrence
Text
ThreadIndex
Threading
Url
User
UserMulti
WorkflowEventType
WorkflowStatus

GROUPBOARD Field Types




NameUse
CallTo
Confirmation
ContactInfo
Facilities
FreeBusy
Overbook
SendTo
WhereAbout

GROUPBOARD Upgrade Field Types (do not use)




NameUse
GbwLocation
GbwParticipants
GbwSREnd
GbwSRStart

Hold Field Types




NameUse
HoldsField
ExemptField

Publishing Field Types




NameUse
HTML
Image
Link
SummaryLinks
LayoutVariationsField
ContentTypeIdFieldType
PublishingScheduleStartDateFieldType
PublishingScheduleEndDateFieldType
MediaFieldType

SPRating Field Types




NameUse
AverageRating
RatingCount

TargetTo Field Types




NameUse
TargetTo

Taxonomy Field Types




NameUse
TaxonomyFieldType
TaxonomyFieldTypeMulti

Thursday, November 8, 2012

How to implement insert/update/delete in GridView for List with Lookup and Choice columns?




<asp:GridView ID="GridView1" runat="server" EnableTheming="False" OnRowCreated="GridView1_RowCreated">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server">
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
</asp:GridView>
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
  {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataTable dt = new DataTable("nameList");
                dt.Columns.Add("name");
                SPSite site = new SPSite("http://jack-7716f30e37:80");
                using (SPWeb Web = site.OpenWeb())
                {
                    SPList mylist = Web.Lists["MyList"];
                    SPQuery query = new SPQuery();
                    SPListItemCollection items = mylist.GetItems(query);
                    foreach (SPListItem item in items)
                    {
                        DataRow row = dt.NewRow();
                        row["name"] = item["Title"];
                        dt.Rows.Add(row);
                    }
                }

                ((DropDownList)e.Row.FindControl("DropDownList1")).DataSource = dt;
                ((DropDownList)e.Row.FindControl("DropDownList1")).DataTextField = "name";
                ((DropDownList)e.Row.FindControl("DropDownList1")).DataBind();
            }
}

Tuesday, November 6, 2012

SharePoint 2010 TreeView Example

Collect All Site and Sub Site with content

Using <SharePoint:SPTreeView>


<div class="ms-quicklaunchouter" runat="server">
    <div class="ms-treeviewouter">
        <SharePoint:SPRememberScroll runat="server"
            id="RememberScroll1"
            onscroll="javascript:_spRecordScrollPositions(this);"
            style="width: 220px;">
            <Sharepoint:SPTreeView runat="server"
                id="TreeView1"
                ShowLines="false"
                DataSourceId="TreeViewDataSource1"
                ExpandDepth="0"
                SelectedNodeStyle-CssClass="ms-tvselected"
                NodeStyle-CssClass="ms-navitem"
                NodeStyle-HorizontalPadding="2"
                SkipLinkText=""
                NodeIndent="8"
                ExpandImageUrl="/_layouts/images/tvclosed.png"
                ExpandImageUrlRtl="/_layouts/images/tvclosedrtl.png"
                CollapseImageUrl="/_layouts/images/tvopen.png"
                CollapseImageUrlRtl="/_layouts/images/tvopenrtl.png"
                NoExpandImageUrl="/_layouts/images/tvblank.gif"
                NodeWrap="True">
            </Sharepoint:SPTreeView>
        </Sharepoint:SPRememberScroll>
    </div>
</div>
<SharePoint:SPHierarchyDataSourceControl runat="server"
    id="TreeViewDataSource1"
    RootContextObject="Web"
    ShowFolderChildren="true"
    IncludeDiscussionFolders="false"/>

Custom Action Ribbon with Popup Window


 Custom Action Ribbon With Popup Window


 <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="SiteActionsToolbar"
       GroupId="PersonalActions"
       Location="Microsoft.SharePoint.StandardMenu"
       Sequence="1050"
               
       Title="Change Password"
       Description="Change the Password"
       ImageUrl="/_layouts/IMAGES/picture.jpg">
    <UrlAction Url="javascript:OpenPopUpPageWithTitle('{SiteUrl}/_layouts/CustomActionRibbon/Forget Password.aspx', RefreshOnDialogClose, 600, 300,'Change Password')"/>
  </CustomAction>
</Elements>

 

Custom Action Ribbon





<CustomAction
  
    Id="SkynetCustomRibbonButton"
    RegistrationId="101"
    RegistrationType="List"
    Location="CommandUI.Ribbon"
    Sequence="5"
    Title="Move Documents">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
          <Button
              Id="Ribbon.Documents.New.SkynetTestButton"
              Alt="Move Documents"
              Sequence="5"
              Command="Skynet_Test_Button"
              Image32by32="http://igrid108:44/SiteAssets/searchserver.ico"
              Image16by16="http://igrid108:44/SiteAssets/searchserver.ico"
              LabelText="Move Documents"
              TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="Skynet_Test_Button"
          CommandAction="javascript:alert('SharePoint 2010 Rocks!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
--------------------------------------------------------

 <CustomAction
        Id="Comments.Link"
        RegistrationType="List"
        RegistrationId="101"
        Location="EditControlBlock"
        Sequence="350"
        Title="Comments"
        ImageUrl="~/_layouts/1033/IMAGES/CommentsIcon.png"
       Description="Can add comments">
    <UrlAction Url="/_layouts/TR_DMS_DiscussionBoard/TR_DiscussionBoard.aspx?List={ListId}&amp;ID={ItemId}&amp;"/>
  </CustomAction>
----------------------------------------------------------

Thursday, November 1, 2012

Programmatically download documents from document library Sharepoint

Programmatically download documents from document library Sharepoint
Lets look the code to download documents from a Document Library

SPList currentLib = web.Lists["LibraryName"];

Get all items from the document library

foreach (SPListItem item in items)
{

byte[] binfile = item.File.OpenBinary();

FileStream fstream = new FileStream("C:\\" + item.File.Name,
FileMode.Create, FileAccess.ReadWrite);

fstream.Write(binfile, 0, binfile.Length);

fstream.Close();
}

Tuesday, October 16, 2012

Branding: Custom Footer


Branding: Custom Footer

In some cases when you need to add a footer to a custom brand you will notice that on pages that have really tall left navigations (Quick Launch) and a small content area the left side navigation will overflow and display on top of your custom footer.
The reason for this is that your left side navigation is floating to the left of the content area. And therefore it is no longer being considered for height and will ignore your footer. By default your content area will push your custom footer down as it grows larger.
Here is an example where the left navigation is really long and floats on top of the custom footer:
image
To fix this you will need to set the footer div to have a inline-block property and also set the width to 100%. Your custom footer will be included right below that DIV. See below example.
<div id="s4-bodyContainer">
    <div id="s4-mainarea">         <div id="s4-leftpanel"></div>
        <div class="s4-ca”></div>
    </div>
    <div class="custom-footer"></div> 
</div>
Here is some sample CSS that you can use to fix this:
Before:
.custom-footer{
    padding: 20px 0px 20px 0px;
    background-color: #21374c;
    color: #FFF;
    text-align: center;
    width: 100%;
}
After:
.custom-footer{
    display: inline-block;
    width: 100%;

    margin-top: 20px;
    padding: 20px 0px 20px 0px;
    background-color: #21374c;
    color: #FFF;
    text-align: center;
}
The top margin is just used to give some extra space between the footer and the left navigation.
This is how the page should look now.
image
For Center fixed width designs you would have something like this:
body #s4-workspace{
    background-color: #000;
}
body #s4-bodyContainer{
    width: 900px !important;
    margin: auto !important;
    background-color: #FFF;
}
.custom-footer{
    display: inline-block;
    width: 100%;

    margin-top: 20px;
    padding: 20px 0px 20px 0px;
    background-color: #21374c;
    color: #FFF;
    text-align: center;
}
And the result would look like this:
image
Enjoy!

Saturday, October 6, 2012

Databases Created During SharePoint 2010 Install

Database Created During SharePoint 2010 Install



The databases that are automatically created when you run the SharePoint Products Configuration Wizard for SharePoint Server 2010, Standard Edition -

1. Secure Store database - The Secure Store service application database stores and maps credentials, such as account names and passwords. Prefixed with "Secure_Store_Service_DB_".

2. State database - The State service application database stores temporary state information for InfoPath Forms Services, the chart Web Part, and Visio Services. Prefixed with "StateService".

3. Web Analytics Staging database - The Staging database temporarily stores un-aggregated fact data, asset metadata, and queued batch data for the Web Analytics service application. Prefixed with "WebAnalyticsServiceApplication_StagingDB_"

4. Web Analytics Reporting database - The Reporting database stores aggregated standard report tables, fact data aggregated by groups of sites, date and asset metadata, and diagnostics information for the Web Analytics service application. Prefixed with "WebAnalyticsServiceApplication_ReportingDB_"

5. Search service application Administration database -The Administration database hosts the Search service application configuration and access control list (ACL), and best bets for the crawl component. This database is accessed for every user and administrative action. Prefixed with "Search_Service_Application_DB_".

6. Search service application Crawl database - The Crawl database stores the state of the crawled data and the crawl history. Prefixed with "Search_Service_Application_CrawlStoreDB_'.

7. Search service application Property database - The Property database stores information that is associated with the crawled data, including properties, history, and crawl queues. Prefixed with "Search_Service_Application_PropertyStoreDB_"

8. User Profile service application Profile database - The Profile database stores and manages users and associated information. It also stores information about a user's social network in addition to memberships in distribution lists and sites. Prefixed with "User Profile Service Application_ProfileDB_".

9. User Profile service application Synchronization database -The Synchronization database stores configuration and staging data for use when profile data is being synchronized with directory services such as Active Directory.Prefixed with "User Profile Service Application_SyncDB_".

10. User Profile service application Social Tagging database - The Social Tagging database stores social tags and notes created by users, along with their respective URLs.Prefixed with "User Profile Service Application_SocialDB_".

11. Managed Metadata database - The Managed Metadata service application database stores managed metadata and syndicated content types. Prefixed with "
Managed Metadata Service_".


In addition to all the databases created with Standard edition, Enterprise addition install adds two more databases :

1. PerformancePoint service application database - The PerformancePoint service application database stores temporary objects, persisted filter values, and user comments. Name Prefix "PerformancePointServiceApplication_.."

2. Word Automation Services database - The Word Automation Services database stores information about pending and completed document conversions.Name Prefix "WordAutomationServices_..."


Note : You do not have to use these naming conventions

Tuesday, September 11, 2012

SharePoint Server Template Values

100 Generic list
101 Document library
102 Survey
103 Links list
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list
108 Discussion board
109 Picture library
110 Data sources
111 Site template gallery
112 User Information list
113 Web Part gallery
114 List template gallery
115 XML Form library
116 Master pages gallery
117 No-Code Workflows
118 Custom Workflow Process
119 Wiki Page library
120 Custom grid for a list
130 Data Connection library
140 Workflow History
150 Gantt Tasks list
200 Meeting Series list
201 Meeting Agenda list
202 Meeting Attendees list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 Meeting Things To Bring list
212 Meeting Workspace Pages list
300 Portal Sites list
301 Blog Posts list
302 Blog Comments list
303 Blog Categories list
850 Page Library
1100 Issue tracking
1200 Administrator tasks list
2002 Personal document library
2003 Private document library

Thursday, July 26, 2012

javascript popup window when button click

login.ascx

<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" OnClientClick="javascript:return test(this);" />

------------------------------------------------------------

script language="javascript" type="text/javascript">
function test(obj)
{
var item = obj.id;
item = item.replace("imgedit", "hdn");
var itemid = document.getElementById(item).value;
var options = {
url:"/_Layouts/SharePointProject2/ApplicationPage1.aspx?Itemsvalue=" + itemid,
width: 600,
height: 400,
showClose:true,
title:"Edit Notes"
};
SP.UI.ModalDialog.showModalDialog(options);
return false;
}
</script>