Archive

Archive for the ‘SharePoint 2010’ Category

Programmatically Creating Site Backup in SharePoint

April 29, 2017 Leave a comment

Hello all,

try this example to Create Site Backup in SharePoint from Code


using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace SiteBackUp
{
public class SiteBackup
{
static void Main(string[] args)
{
siteBackup("http://servername:portnumber","SharePointSiteBackup");
}
public static void siteBackup(string siteURL,string fileName)
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using(SPSite objSite=new SPSite(siteURL))
{
using(SPWeb objWeb=objSite.OpenWeb())
{
bool currentSiteStatus=objSite.AllowUnsafeUpdates;
objSite.AllowUnsafeUpdates=true;
bool currentWebStatus=objWeb.AllowUnsafeUpdates;
objWeb.AllowUnsafeUpdates=true;
string comment = objWeb.Title+"- Creating Backup is completed";
SPSiteCollection siteCollection=objSite.WebApplication.Sites;
objSite.ReadOnly=true;
string time=DateTime.Now.ToString("dd-MM-yyyy");
string backupName= "D:\\SiteBackup\\Backup" + fileName+"_"+time+".bak";
siteCollection.Backup(siteURL,backupName,false);
objSite.AllowUnsafeUpdates=currentSiteStatus;
objWeb.AllowUnsafeUpdates=currentWebStatus;
if(objSite.ReadOnly==true)
{
objSite.ReadOnly=false;
siteBackupLog(comment);
}
}
}
});
}
catch (Exception ex)
{
SPSite site = new SPSite(siteURL);
if (site.ReadOnly == true)
site.ReadOnly = false;
siteBackupLog(ex.Message);
}
}

public static void siteBackupLog(string message)
{
string PathName = "C:\\SiteBackup logs\\";
PathName = PathName + "Backuplog-" + DateTime.Now.ToString("dd-MM-yyyy") + ".log";
StreamWriter sw = new StreamWriter(PathName, true);
sw.WriteLine(message + " - " + DateTime.Now);
sw.Flush();
sw.Close();
}
}
}

Good Luck

Categories: SharePoint 2010

How to Upload a SharePoint List Template

December 17, 2015 Leave a comment

Hi all,

Follow this steps to Upload List Template in SharePoint 2010

– Go to the Home of your site

– Click on Site Actions and select Site Settings

– Under Galleries select List Templates

– Click the Documents tab and select Upload Document

– Select the list template (.stp file) that you want to upload

– Now you can create a list based on your new template

Good Luck

 

Delete SharePoint 2010 site Step By Step

July 15, 2015 Leave a comment

Hi all,

Flow the following steps to delete SharePoint 2010 Site

First open Central Admin:

Click on Central Administrator -> And Click on Manage Web Application

DSP1

Select your website to delete…

DSP2

Click on Delete Button…

DSP3

Choose your option to delete content database and IIS webSite…

DSP4

Click OK..

DSP5

Site deleted successfully… Now check Central Administrator

DSP6

Now check IIS…

DSP7

Good Luck.

Categories: SharePoint 2010

How to configure Business Data Connectivity access rights in SharePoint 2010

February 22, 2015 Leave a comment

Hi all,

Follow the following steps to configure Business Data Connectivity access rights in SharePoint 2010

1. Open Central Administration page, and click on Manage service application.

SPS2010_BDC0012_thumb

2. Click on Business Data Connectivity Service

SPS2010_BDC0013_thumb

3. Open the context menu of the External Content type (ie. External CT in this example). Click on Set permissions.

SPS2010_BDC0014_thumb

4. Add account (Group, or User) and assign the permissions.

SPS2010_BDC0015_thumb

5. Set appropriate permission to the BDC object. Remember that BDC object permission rules the interaction between user and external data source through BDC object. It doesn’t rules his/her permission accessing Forms in the list (New / Edit / Delete  form).

SPS2010_BDC0016_thumb

Hope this helps

Good Luck.

Categories: SharePoint 2010

Bind DropdownList from SharePoint List

November 14, 2014 Leave a comment

Hi all,

try this example to Bind DropdownList from SharePoint List

if (!Page.IsPostBack)
{
DataSet ds = new DataSet();
SPSite mySite = SPContext.Current.Site;
SPWeb myWeb = mySite.OpenWeb();
SPList list = myWeb.Lists["ListName"];
DataTable DTable_List = list.Items.GetDataTable();
DTable_List.TableName = "MyDTable";
ds.Tables.Add(DTable_List);
DropDownList.DataSource = ds.Tables["MyDTable"];
DropDownList.DataTextField = "FieldName";
DropDownList.DataValueField = "FieldName";
DropDownList.DataBind();
DropDownList.SelectedIndex = 0;
}

Hope this helps

Good Luck

Categories: SharePoint 2010

Solution for “Access denied by Business Data Connectivity” Error

October 10, 2014 Leave a comment

If you are trying to create external data type list and get the error “Access Denied by Business Data Connectivity” then the most common reason for that can be the incorrect permissions for your target External Content Type. To fix the issue, please perform the following steps:

1- Open your SharePoint 2010 Central Administration Page
2- Under Application Management, click Manage service applications
3- Click Business Data Connectivity Service link
4- List of all external content types will be displayed, select your target external content type by checking it
5- Click Set Object Permissions on Ribbon
6- “Set Object Permissions” dialogue box will be displayed, add yourself or any other users, as you want
7- Check at least Selectable in client permission in permissions list
8- Click OK to save your changes
Now try to view your external content types list and Bingo! there will be no more “Access denied by Business Data Connectivity” error message!

Categories: SharePoint 2010

Allow and Enable Anonymous Users Access In SharePoint 2010 Sites

October 10, 2014 Leave a comment

Hi all,

try this example to Allow and Enable Anonymous Users Access In SharePoint 2010 Sites

1. Open SharePoint 2010 Central Administration, Go to Manage Web Applications

A1

2- Select Your Site and click on Authentication Providers icon in the top ribbon bar

A2

3- Click on Default Zone and Check the Enable Anonymous Access CheckBox and save it

A4

A3

4- Select your site and click on Anonymous Policy Icon In ribbon

A5

5- Select Default Zone from dropdown and select the permissions option you want to grant to anonymous users Selecting None – No Policy is recommended )

A6

6- Close Central Administration and open your site collection in browser with administrator account (Site for which you just had set anonymous access)

Click on Site Actions and select Site Permissions

A7

7- Click on Anonymous Access Icon on the top ribbon

A8

8- Select Entire Web Site Option and click on OK

A9

9- Now you can browse your site Anonymously without login.

A10

Hope this helps

Good Luck.

Categories: SharePoint 2010