Header

Monday, 24 October 2011

How to get User Details in sharepoint.

////////////////////////////////////////////////////////

  1. Dim user As SPUser = SPContext.Current.Web.CurrentUser

  2. Checking is current login is admin or not?

    SPContext.Current.Web.CurrentUser.IsSiteAdmin

  3. This will give, all group, which are present in current site

    SPContext.Current.Web.Groups

    This will give the group name of current user

    SPContext.Current.Web.CurrentUser.Groups

  4. Here i m getting all user and add in one DropDownList

    Dim websp As SPWeb = SPContext.Current.Site.RootWeb
    Dim users As SPUserCollection = websp.AllUsers
    For Each i As SPUser In users
    dropdownlist1.Items.Add(CStr(i.Name))




How to get connected to a site in sharepoint.

////////////////////////////////////////
How to get connected to a site in sharepoint.
////////////////////////////////////////
1)
     Dim oWebsite As SPWeb = SPContext.Current.Web
2)
     Using oWebsiteRoot As SPWeb = SPContext.Current.Site.RootWeb
                ...
     End Using
3)
     Using oWebsite As SPWeb = SPContext.Current.Site.OpenWeb("Website_URL")
  ...
      End Using
4)
      Using oSiteCollection As New SPSite("http://server_name/")
         Using oWebsite As SPWeb = oSiteCollection.OpenWeb("Website_URL")
             Using oWebsiteRoot As SPWeb = oSiteCollection.RootWeb
                  ...
             End Using
         End Using
      End Using
5)
      Dim myWeb As SPWeb = SPContext.Current.Web
      Debug.WriteLine("MyWeb lists : ")
                        For Each aList As SPList In myWeb.Lists
                              Debug.WriteLine("************************************")
                              Debug.WriteLine("list Title (Display Name): " & aList)
                              Debug.WriteLine("list Title (Display Name): " + aList.Title)
                              Debug.WriteLine("list Root Folder Name: " + aList.RootFolder.Name)
                              Debug.WriteLine("************************************")
                         Next

Sunday, 23 October 2011

How to send email using Javascript....

How to send E-mail with subject


This is a small function that is use for simply sending msg with subject.............

function sendMail() {

     var link  = 'mailto:?subject=Here You can put ur Subject&body='; 
 
     var curntLoc=window.location.href;
     link +=escape(curntLoc);
  window.location.href = link;
   // window.location.href = link;
}

Thursday, 20 October 2011

Hot to get Current user name using SPAPI

 This post has been moved to this

http://unique2026.blogspot.in/2013/08/hot-to-get-current-user-name-using-spapi.html


Get Query String Value

How to get value from QueryString.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function querySt(elementName) {
                curulr = window.location.search.substring(1);
                qryElement = curulr.split("&");
                for (i=0;i< qryElement.length;i++) {
                                spltdElement = qryElement [i].split("=");
                                                if (spltdElement[0] == elementName) {
                                                return spltdElement[1];
                                                }
                                }
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
This is very small function but very power full. You need to pass query string element name and if it is in query string it will return the value what it is holding.
Here is an example…
I want to get value of ID from query string using this function.
var _newID= querySt(“ID”);
alert(_newID);
now I will get one alert with value of id…..

How to start with SPAPI in Sharepoint

 This post has moved to this link.

http://unique2026.blogspot.in/2013/08/how-to-start-with-spapi-in-sharepoint.html

Wednesday, 19 October 2011

How to change web parts Title Style


<style>

.ms-WPHeader TD[title^='Testing'] {
HEIGHT: 50px;
BACKGROUND: url(/HomePage-Images/announcements_1px.png);
}
.ms-WPHeader TD[title^='Testing'] SPAN:first-child {
PADDING-LEFT: 55px;
WIDTH: 65px;
PADDING-TOP: 0px;
}
.ms-WPHeader TD[title^='Testing'] H3 {
PADDING-BOTTOM: 0px;
 MARGIN: 0px;
PADDING-LEFT: 0px;
PADDING-RIGHT: 7px;
HEIGHT: 55px;
COLOR: black;
FONT-SIZE: 1.2em;
PADDING-TOP:0px;
BACKGROUND: url(/HomePage-Images/announcements.png) no-repeat left top;
}
</style>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
.ms-WPHeader TD[title^='Testing']
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
By using -----TD[title^='Testing']------  i m trying to find web part whose Title is Testing . It may be your is different.
After that i m giving background image for title. You can give any color.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
.ms-WPHeader TD[title^='Testing'] SPAN:first-child
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This one i m using for putting style sheet for title(Testing" ). It may u need to set padding top for alignment.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ms-WPHeader TD[title^='Testing'] H3
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I m using this for left side image