Wednesday, October 22, 2014
Create list in SharePoint 2013 using OOB feature:
Posted by
Santhosh,
on
12:44 AM
Hi Guys,
I will let you know , how to create a custom list in SharePoint 2013.
The only confusion to create list unlike SP2010 is we need to select App for creating the List
Select Settings Icon--->Site Contents-->Add App-->Select Custom List-->Name the List-->Create.
here we go...we have successfully created..
Now you can create your own custom Columns of your choice ..
If you want to create a new column --->Select New Column from ribbon ..
Thursday, October 16, 2014
Export Grid View Data to Excel
Posted by
Santhosh,
on
11:42 PM
private void ExportGriviewToExcel(System.
Web.UI.WebControls.GridView gvReport, string fileName)
{
try
{
DateTime dtCurrentdate = System.DateTime.Now;
fileName = fileName + '-' + dtCurrentdate.Date. ToShortDateString();
var attachment = "attachment; filename=" + fileName + ".xls"; //Setting the attachment name.
HttpContext.Current.Response. ClearContent(); //clears all content output from the buffer stream.
HttpContext.Current.Response. AddHeader("content- disposition", attachment);
HttpContext.Current.Response. ContentType = "application/vnd.ms-excel";
using (var sw = new StringWriter())
{
using (var htw = new HtmlTextWriter(sw))
{
using (var frm = new HtmlForm())
{
gvReport.AllowPaging = false;
gvReport.DataSource = dtTAt;
gvReport.DataBind();
gvReport.Parent.Controls. Add(frm);
frm.Controls.Add(gvReport);
frm.RenderControl(htw);
HttpContext.Current.Response. Write(sw.ToString());
HttpContext.Current.Response. End();
}
}
}
}
catch (Exception ex)
{
}
}
{
try
{
DateTime dtCurrentdate = System.DateTime.Now;
fileName = fileName + '-' + dtCurrentdate.Date.
var attachment = "attachment; filename=" + fileName + ".xls"; //Setting the attachment name.
HttpContext.Current.Response.
HttpContext.Current.Response.
HttpContext.Current.Response.
using (var sw = new StringWriter())
{
using (var htw = new HtmlTextWriter(sw))
{
using (var frm = new HtmlForm())
{
gvReport.AllowPaging = false;
gvReport.DataSource = dtTAt;
gvReport.DataBind();
gvReport.Parent.Controls.
frm.Controls.Add(gvReport);
frm.RenderControl(htw);
HttpContext.Current.Response.
HttpContext.Current.Response.
}
}
}
}
catch (Exception ex)
{
}
}
People picker Browser Compatability Issue
Posted by
Santhosh,
on
6:46 AM
People Picker is not working on computers that have IE 11 installed
Unfortunately this is a known issue with People Picker and IE Version 11 and probably 10 as well.Recently i came across a situation where am not able to work with people picker in IE 11 but am able to open the same thing in IE 9 and other browsers as well. So i started trying to identify the issue .
anyhow i will explain you how to fix it but this is a short-term solution. If Microsoft comes up with solution then we can go ahead .
Title : People Picker Compatibility issue in IE 11 Browser .
Meta Tag : <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
Description :
Phyisical path of pickerdialog.master file : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS.
Please take the back up of pickerdialog.master from production .
Open the pickerdialog.master add the meta tag “<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> under head section”.
Save the pickerdialog.master .
Followed by IISREST.
Wednesday, October 15, 2014
Creation of List View Web parts in SharePoin 2013 and 2010
Posted by
Santhosh,
on
8:41 AM
Some times we come across a situation where in we want to display list data on the home page or any other pages .
I will show you the simple way of creating the List view web parts in SharePoint 2013
Create any custom list inside of your site. say "Students".
Now , you want to see the list on the page as a report or something else .
Create page or existing page ...
Edit Page --> add web Part-->webparts gallery --->Lists and Libraries (Under this section you will be able to see the list "Students". Select the List and Click ok .
Then the list will be placed on your page .
By default it will show you all the columns inside the list "Students".
If you wants to see only particular columns as per your interest then you can modify the view
By editing the web part we can modify the Current View also .
Note :
All the Views created inside the list will be Shown in web part . If you done any changes inside list view again you need to edit that webpart and set that as default then only the changes reflects..
Applying Site Page as default home page in SharePoint 2010 and 2013
Posted by
Santhosh,
on
7:30 AM
Goto Site Actions-->Site Settings-->Look and Feel --->Welcome page
Change the Page url ...
All set now you are able to see the site page as home page of your site .
Change the Page url ...
All set now you are able to see the site page as home page of your site .
- Programatically......Changing the Welcome Page
public static void ChangeWelcomePage(SPWeb rootWeb, string pageName) { if (PublishingWeb.IsPublishingWeb(rootWeb)) { PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(rootWeb); //Get the file name SPFile welcomeFile = rootWeb.GetFile(pageName); //Assign the new filename to the DefaultPage property pubWeb.DefaultPage = welcomeFile; //Update the Publishing Web. pubWeb.Update(); } }
Power Shell .
Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue################################################### code###################################################$sourceWeb = $null try { $SiteUrl = "http://adigroup/myteamsite" $sourceWeb = Get-SPSite -identity $SiteUrl $oFolder = $sourceWeb.RootFolder; $oFolder.WelcomePage = "Pages/MyCustomPage.aspx"; $oFolder.Update();} catch { write-host $_.exception} finally { if($sourceWeb -ne $null){$sourceWeb.Dispose()}}
Monday, October 13, 2014
Importance and Difference between SPListItem.Delete() method and SPListItem.Recycle() method.
Posted by
Santhosh,
on
10:48 PM
If you delete a document in SharePoint using the UI, it’s being moved to the Recycle Bin, so that it can be restored if necessary. There are situations when you want to include deleting list items and documents in your custom solutions. The most commonly used approach I’ve seen is calling the SPListItem.Delete() method. While this does the job, and deletes the item, it deletes it permanently instead of moving to the Recycle Bin.
Looking carefully at the SPListItem class, you can find SPListItem.Recycle() method. It turns out that it’s exactly that method that you need to call in order to move a list item/document to the Recycle Bin instead of deleting it permanently.
In general moving items to the Recycle Bin instead deleting them permanently is what you should do in our custom solutions. It is standard SharePoint behavior and therefore something end users will expect of our solutions as well. You should perform the permanent deletion only if explicitly named in the requirements. Otherwise, let’s just stick to what SharePoint does to leverage the same User Experience.
Internally there isn’t much difference between the SPListItem.Delete and SPListItem.Recycle methods. Both call an internal SPListItem.Delete method with a different parameter which determines whether an item should be moved to the Recycle Bin or permanently deleted.
Looking carefully at the SPListItem class, you can find SPListItem.Recycle() method. It turns out that it’s exactly that method that you need to call in order to move a list item/document to the Recycle Bin instead of deleting it permanently.
In general moving items to the Recycle Bin instead deleting them permanently is what you should do in our custom solutions. It is standard SharePoint behavior and therefore something end users will expect of our solutions as well. You should perform the permanent deletion only if explicitly named in the requirements. Otherwise, let’s just stick to what SharePoint does to leverage the same User Experience.
Internally there isn’t much difference between the SPListItem.Delete and SPListItem.Recycle methods. Both call an internal SPListItem.Delete method with a different parameter which determines whether an item should be moved to the Recycle Bin or permanently deleted.
- public override void Delete()
- {
- if (this.HasExternalDataSource)
- {
- SPUtility.ValidateFormDigest();
- string bdcid = (string) ((string) this.GetValue("BdcIdentity"));
- this.ParentList.DataSource.DeleteItem(bdcid);
- }
- else
- {
- this.DeleteCore(DeleteOp.Delete);
- }
- }
- public System.Guid Recycle()
- {
- if (this.HasExternalDataSource)
- {
- SPExternalList.ThrowNotSupportedExceptionForMethod("Recycle", base.GetType());
- }
- return this.DeleteCore(DeleteOp.Recycle);
- }
Monday, October 6, 2014
How to edit a page that has no “Edit Page” menu option in SharePoint( 2010 ,2013)
Posted by
Santhosh,
on
8:08 AM
Some times we come across a situation where we can t find the edit button in ribbon even if we have full control .
Solution :
Add the below parameter to your URL .
?ToolPaneView=2&pagemode=edit\
sample URL :http://SharePointSite/pages/sample.aspx?ToolPaneView=2&pagemode=edit
Subscribe to:
Posts
(
Atom
)