SPUtility
来源:互联网 发布:debian centos 编辑:程序博客网 时间:2024/06/05 08:45
Allows you to format a given date to any of the SPDateFormat types
DateTime curDate = DateTime.Now();DateTime regionDate = web.RegionalSettings.TimeZone.UTCToLocalTime(web.ParentWeb.RegionalSettings.TimeZone.LocalTimeToUTC(curDate));return Convert.ToDateTime(SPUtility.FormatDate(web, regionDate, SPDateFormat.ISO8601));
Returns the filesystem path for the 12-Hive, or any of the folders beneath it. This is typically (though not always) going to be C:\Program Files\Common Files\Microsoft Shared\web server extensions\12
//Get path to features directory//Would typically return "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES"string featurePath = SPUtility.GetGenericSetupPath("template\\features");
Converts a relative Url into an absolute Url
//Get url to list itemSPListItem item = spList.Items[1];string itemUrl = SPUtility.GetFullUrl(spSite, item.Url);
Send a HTTP redirect to the client's browser
//Redirect to specified page, adding querystringstring url = "http://portal/TestResults/Pages/results.aspx"; string queryString = "successflag=passed";SPUtility.Redirect(url, SPRedirectFlags.Default, Context, queryString);
Lets you send an email from the context of the given SPWeb
//Send email from current SPWebSPWeb web = SPContext.Current.Site.OpenWeb();string subject = "Email from the " + web.Title + " web";string body = "The body of the email";SPUtility.SendEmail(web, false, false, "someone@somewhere.com", subject, body);
Allows you to transfer the browser to the ootb error and success pages
//Transfer to Error PageSPUtility.TransferToErrorPage(ex.Message); //Transfer to success page, and specify url to move onto after "Ok" clickedSPUtility.TransferToSuccessPage("Operation was completed", @"/Docs/default.aspx", "", "");
http://www.cnblogs.com/ceci/archive/2009/10/09/1579725.html
- SPUtility
- SPUtility.TransferToErrorPage的用法
- 找工作中常见的PHP面试题及答案(2)
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- C#遍历ComboBox
- ORA-12519: TNS:no appropriate service handler found 解决
- Error: ShouldNotReachHere() [整理]
- SPUtility
- 在XCODE中开发Iphone/Ipad 使用sqlite的Data Core框架.
- 郁闷的时候偷着乐
- 对象序列化
- Shell技巧:提示行魔术
- java 内部类
- 注解
- 新站SEO从什么地方开始
- wpa_supplicant使用笔记