Hi All,
Many times I wonder about SPUtility class, it’s having really very handy and useful methods to explore.
Here I would like to share certain methods that I come across which can really reduce your work of coding a lot. Because not knowing these methods can cause you lot of work. So better to know them at very first glance.
SPUtility.GetGenericSetupPath("template\\features”);
This will return you C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES
Think what all things that you have done to make this kind of thing happen( Place tag in web.config, make constant or some stuff like this).
string fullName;
string returnvalue = SPUtility.GetAccountName(fullName);
This will return AccountName as string.
Then here is one more interesting method:
public static void GetFullNameandEmailfromLogin (
SPWeb web,
string login,
out string displayName,
out string email
)
which will return you Name in displayname paramter as you can see its mentioned as out and from login it will return email as out paramter.
Other Method is GetFullNameFromLogin which returns fullname from login name.
string returnValue = SPUtility.GetFullNameFromLogin(site, loginName)
Other method is GetLoginNameFromEmail which takes email and outputs login name
string returnvalue = SPUtility.GetLoginNameFromEmail(site, email)
But its an obsolete method. so you can use this new method :
SPUtility.GuessLoginNameFromEmail with same parameters and same output.
but i wonder rest of methods start with Get, why this methd starts with Guess?????????? Is it developer's Mistake?? Or else i really wanted to know logic behind this. Let me know if anyone come across to this.
String input;
String folderUrl;
String returnValue;
returnValue = SPUtility.ConvertHtmlLinkToWikiLink(input, folderUrl)
Same way we have :
returnValue = SPUtility.ConvertWikiLinkToHtmlLink(input, folderUrl)
Are some of the handy methods to try with.
Thank you
SharePoint Kings,Technosavvy guys hunting SharePoint Challenges... SharePoint 2013, SharePoint 2010, MOSS 2007, Windows Workflow Foundation, Project Server and Other Related Technologies.
Subscribe to:
Post Comments (Atom)
Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!
If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com
No comments:
Post a Comment