Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Wednesday, December 31, 2014

SharePoint App solution vs SharePoint solution deployment

Why should we need an App deployment model 

To fully understand Microsoft's motivation for beginning to transition away from SharePoint solution to the new app model  you must first understand the challenges in SharePoint solution..
Custom developed SharePoint solution runs within the host environment like Sandbox Solution runs within the sandbox worker process.  This behavior is not so good for farm's stability.
Second, SharePoint developed solutions with complex logic and highly dependability are not so easy to upgrade. What if any custom code is depended on a feature and that feature is deprecated or not coming in next version ?
Third is security and permission, code runs under the permission of  a specific user. Which could be risky sometimes.
So, App models solve these challenges..ex.
1.It is light weight. It doesn't carry extra markup like a webPart.
2. It runs in isolation of SharePoint. It has to authentication separately before using.

3.  Use any language - like HTML, JavaScript, PHP, or .NET - and your favorite web development tools - like Visual Studio 2012 or the new "Napa" Office 365 Development Tools.

4. Easy to upgrade.

Thursday, September 11, 2014

Create site collection programmatically in sharepoint 2013 with custom web template

To create site collection programmatically by using server object model use SPWebApplication .Sites.Add method. it has 12 overloads. choose any one which suits you. In this given code I am creating a site collection on host header (not on root site).
References :
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

Code:

 public void CreateSitecollection(string url, string title, string description, string ownerLogin, string ownerName, string ownerEmail, SPWebApplication webApp)
        {
            Uri urlNewSite = new Uri(url);
            try
            {
                if (!SPSite.Exists(urlNewSite))
                {

                    using (SPSite newSiteCollection = webApp.Sites.Add(
                        url,// url of the new site,give full url if you want to create site on host header else"/sites/anyname"
                       title,// title of the new site
                       description,//description
                       1053,//LCID
                       "WT_CollaborationSite",//give custom template naem
                       ownerLogin,// login anme like "corp\devuser"
                       ownerName,// name
                       ownerEmail,// email id of the primary user
                       ownerLogin, // secondry user
                       "",
                       "",
                       true))// user host header
                    {
                     
                    }
                }
                else
                {
                    throw new ArgumentNullException("Site already exists");
                }
            }
            catch (Exception)
            {
             
            }
        }


use this code anywhere like in a timer job or in a console application. give the "STS#0" in the template name if you want to use team site template.

Tuesday, May 27, 2014

Sample code to insert items in Composed look list to create a new theme

Hello All,
To create a new theme listing in "change the look" gallery you can create a custom pallete.color file and deploy it to the theme gallery and back ground image and deploy this image to the image folder in layouts.
Now, Create a feature activation receiver and write below code. This piece of code will create a new  entry in Composed looks list in your site. That's all, after that you can your theme listed in change the look gallery.

public override void FeatureActivated(SPFeatureReceiverProperties properties)


{

     

          
SPWeb web = properties.Feature.Parent as SPWeb;

// SPList list = web.GetList("_catalogs/design");

SPList list =web.GetCatalog(SPListTemplateType.DesignCatalog);

SPListItem item = list.AddItem();

item["Title"] = "The Dark Night";

item["Name"] = "The Dark Night";

//item[new Guid("460F49F1-8CF8-4E2D-B38B-30CE8DA26F89")] = "TheDarkNight";

SPFieldUrlValue masterUrl = new SPFieldUrlValue();

//uncomment below line to deploy in root site

// masterUrl.Url = "/_catalogs/masterpage/seattle.master";

masterUrl.Url = "/sites/Branding/_catalogs/masterpage/seattle.master";

item["MasterPageUrl"] = masterUrl;




SPFieldUrlValue theemUrl = new SPFieldUrlValue();

//uncomment below line to deploy the thems in Root site

//theemUrl.Url = "/_catalogs/theme/15/palette_dk.spcolor";

theemUrl.Url = "/sites/Branding/_catalogs/theme/15/palette_dk.spcolor";

item["ThemeUrl"]=theemUrl;

SPFieldUrlValue imageUrl = new SPFieldUrlValue();

imageUrl.Url = "/_layouts/15/images/MyThemes/dk011.jpg";

item["ImageUrl"] = imageUrl;

item.Update();
//item["FontSchemUrl"] = "";

//item["DisplaOrder"] = "100";

}  

Saturday, May 10, 2014

Steps to create friendly URL's in SharePoint 2013


Send SSRS Reports in Email as attachments in SharePoint 2013 Integrated mode

After creating your SSRS reports and saving them in SharePoint report library, sometimes it is require to send them as an email attachment by using Timer job. this piece of code will help to get this done.
// coming soon 

Monday, April 14, 2014

Steps to Configure SSRS in SharePoint 2013 in integrated mode



Steps to Configure SSRS in SharePoint 2013 in integrated mode


-    Download and install .mssi
-        Configure SQL server and add reporting feature

-        Run Power shell Commands

-        Create A service Application in central admin

-        Create a new Document library for storing reports and add SSRS related Content Types

-        Create Reports

-        Deploy reports
-        Show Reports in SharePoint Page in Web Part


Download and install rsSharePoint.msi



Download and install the rsSharePoint.msi. from here http://www.microsoft.com/en-in/download/details.aspx?id=35583


So that, PowerShell can recognise your ssrs related commands, else you will keep getting this error

“The term 'Install-SPRSService' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again”.


Make sure you are downloading the appropriate version of the installable.
 



 


Configure SQL server and add reporting feature


Now, go to your SQL server installation centre

-Select new sql server standalone installation or add feature to your existing installation

-In choose media option select your set up (or .exe) folder.

-keep going till feature selection section.

- Now, under feature selection select

Reporting service – SharePoint

Reporting service add in- SharePoint
img


Press next.

-        Now under installation of report add in select “ Reporting service SharePoint integrated mode”
img


-        And finish the installation.

Run Power shell Commands

Run these PowerShell to get the option of creating a new SSRS Service application and proxy in SharePoint central admin

1.Install-SPRSService

2.Install-SPRSServiceProxy

3.get-spserviceinstance -all |where {$_.TypeName -like “SQL Server Reporting*”} | Start-SPServiceInstance

Create a SSRS service Application in central admin

-        Go to Central admin -> application management -> manage service application

-        Now, click on new and select SQL server reporting application.

-        Give and name like SSRS and create a new APP Pool.

-        Select the Web Application for which you want to configure SSRS.

Configuration is done.
Now, to create reports follow these steps
Create a new Document library for storing reports and add SSRS related Content Types

Activate a Project Server feature 
Create a document library and add these content types
Report Builder model
-Report builder report
-Report datasource
-Now go to your Document Library ->files-> click new
Choose “Report Builder Report”
Deploy reports and show reports in Page
Now you can create and design the reports and save them in your document library. To Show the reports in a page just add and configure “sql server reporting service web part”.