10/21/2013

Site and Site Collection Retention Policy in SharePoint 2013

Site and Site Collection Retention Policy in SharePoint 2013

One of the biggest problem we face in our SharePoint environment is site retention.  Whenever our users request us with new site collections/sites, we tend to ask to them to clear the security test and we create a new site collection or site.  The problem is, managing the site collections/sites.

Lots off users request sites for either long term projects, short term projects, team spaces, etc., and then they tend to forget to manage it.  These sites will reserve a big amount of space, in addition to that is a mailboxes if they have.

So finally, to resolve all the above issues (till certain point), SharePoint 2013 has came to rescue.  The new “thing” called SharePoint Server 2013 Site (or Site Collection) Policy.

As you can see from the above figure, it allows you to create a Site (or Site Collection) Policy which can be applied to restrict site’s long living life.

Site Closure and Deletion

The difference between site closure and site deletion is, site closure means that when the site is put into the closed mode, the site will NOT be active anymore, means the site is not being updated or being actively used.  You can also manually put the site on closure but to reopen the closed site, you will have to go through the site collection administrators.  When the site is being put onto the closure mode, the system will put site into read-only mode as well.  (in this case as well, only site collection administrators will be able to reopen the site).

Though the users/admins/developers can continue using the site as well as it’s contents, whereas site deletion means the site will be permanently deleted with all of it’s content.

Now, sometimes you will have to postpone the above activity, in that case, the site owner can manually delay the site deletion for a particular period of time (assign by the site policy), if not, then the e-mail would be sent to the site owners before deletion of the site and site will be deleted if no action taken.

By using the above technique, you can always apply site collection policies to each and every new site being requested, which will be deleted if not being used for a certain period of time, ensuring you will save space on your server.  This is also helpful when you want to create a site but doesn’t want to allow any changes.

You can put the site into the closure mode, making it a read-only site and avoid the deletion (I wouldn’t recommend that ), once you define the policy to be applied, you can either directly apply it using the publishing feature from the content hub or apply them during the site creation time where in users will have an option to select.  Check out the Configuring Self Service Site Creation in SharePoint 2013.

Once you set it up, you can go to Central Administration -> Self-Service Site Creation Administration and choose from below three options to make it available to the users.

Once applied, the users will be able to choose the policies while requesting a new site.

Thanks & have fun!!

Reference : Steven Boyle

10/02/2013

Change List URL in SharePoint 2010

Change List URL in SharePoint 2010
Hey Guys,

You know we always messed up with list names in SharePoint 2010, isn't it? Yeah, so me too.

Anyways, so I found the solution to change the URL of the List, basically, there are three ways (which I know of),

First of all:

You can use SharePoint Designer 2010

1.  Open your SharePoint Site using the SharePoint Designer 2010
2.  Go to your list node from all items
3.  right click onto the list node and you can rename it

You can use Windows Explorer

1.  Browse any of your document library in the site
2.  From the default view, click on the “Open with windows explorer” option from the ribbon .
3.  In the windows explorer, go to the root folder of the site.
4. From root folder, go to the library or list you want to change.
5. Right click on the folder and rename it.

You can use PowerShell

Open the list from the site and change the root folder of the site:
if($list -ne $null){
$list.RootFolder.MoveTo($list.RootFolder.Url.Replace($oldlistname, $newlistname));
}


Thanks and have fun!! :)

9/27/2013

Using LINQ to get roll-up data from SharePoint List (DataSet, DataTable, Excel, etc.)

Using LINQ to get roll-up data from SharePoint List (DataSet, DataTable, Excel, etc.)
Hey Guys,
You may find lots of topics and questions posted by [Me] onto the internet for this particular question.

How to use LINQ to get roll-up data?

So, here is the scenario.

I have one SharePoint List as below (you can make DataSet, DataTable, Excel anything you want)

ColumnA     ColumnB      Status
Project1      Task1.1           Completed
Project1      Task1.2           Pending
Project1      Task1.3           Completed
Project2      Task2.1           Completed
Project3      Task3.1           Completed
Project3      Task3.2           Completed
Project3      Task3.3           Completed
Project3      Task3.4           Pending
Project3      Task3.5           Pending

What I need from the above data is:

Project1 66.67 ((Completed Task / Total Task) * 100)
Project2 100
Project3 60

So basically, all I am looking for is rolling up the data and finding the total percentage of project completion.

Easy, huh?

Let's see, so here's the code: (Thanks to Paul Choquette)

var returndata = (from geo in dt.AsEnumerable()
orderby geo["ColumnA"] descending
group geo by geo["ColumnA"] into itemgroup
select new
{
Project = itemgroup.Key,
Percentage = (double)itemgroup.Count(i => (string)i["Status"] == "Complete") / (double)itemgroup.Count() * 100,
}).ToList();

That's it!!

Let me know in case you want anything more from this code ;)

Have fun!!

4/17/2013

Hide "Search This Site..." in SharePoint 2010

Hide "Search This Site..." in SharePoint 2010
Hey Folks,

So, you want to hide "Search This Site..." Box which is located at Top-Right of the SharePoint Site?

Image

It's pretty simple!! (Though initially I tried search it a lot and got many different options but none worked!! :( )

So Finally, I found a solution which actually worked.

Steps:
  • Add a Content Editor Web Part (CEWP)
  • Edit The Web Part and click the Source Editor Button
  • Paste the following:
   <style>
     #SRSB {display:none}
   </style>


Hide It on all Pages:
  • Use SharePoint Designer to edit your master page and put the above style tag just after the SharePoint style controls
   <SharePoint:CssLink runat="server"/>
   <SharePoint:Theme runat="server"/>   <style>
     #SRSB {display:none}
   </style>

4/15/2013

E-Book Gallery for Microsoft Technologies

E-Book Gallery for Microsoft Technologies

Download content for ASP.NET, Office, SQL Server, Windows Azure, SharePoint Server and other Microsoft technologies in e-book formats. Reference, guide, and step-by-step information are all available. All the e-books are free. New books will be posted as they become available at here


LyncMicrosoft Lync Server 2013 Step by Step for Anyone 
OfficeDeployment guide for Office 2013First Look: Microsoft Office 2010
Microsoft Office 365: Connect and Collaborate Virtually Anywhere, Anytime
Microsoft Office 365 for professionals and small businesses: Help and How To
Security and Privacy for Microsoft Office 2010 Users
SharePointExplore SharePoint 2013
Deployment guide for SharePoint 2013
Create a Balanced Scorecard
Configure Kerberos Authentication for SharePoint 2010 Products
SharePoint Server for Business Intelligence
Get started with SharePoint Server 2010
Deployment guide for SharePoint Server 2010
Upgrading to SharePoint Server 2010
Profile synchronization guide for SharePoint Server 2010
Remote BLOB storage for Microsoft SharePoint Server 2010
Governance guide for Microsoft SharePoint Server 2010
Business continuity management for SharePoint Server 2010
Technical reference for Microsoft SharePoint Server 2010
SQL Server5 Tips for a Smooth SSIS Upgrade to SQL Server 2012
A Hitchiker's Guide to Microsoft StreamInsight Queries
Books Online: Backup and Restore of SQL Server Databases
Books Online: Data Analysis Expressions (DAX) Reference
Books Online: Data Mining Extensions (DMX) Reference
Books Online: Data Quality Services
Books Online: High Availability Solutions
Books Online: Master Data Services
Books Online: Monitor and Tune for Performance
Books Online: Multidimensional Expressions (MDX) Reference
Books Online: SQL Server Distributed Replay
Books Online: Transact-SQL Data Definition Language (DDL) Reference
Books Online: Transact-SQL Data Manipulation Language (DML) Reference
Books Online: XQuery Language Reference
Extracting and Loading SharePoint Data in SQL Server Integration Services
Introducing Microsoft SQL Server 2008 R2
Introducing Microsoft SQL Server 2012
Master Data Services Capacity Guidelines
Microsoft SQL Server AlwaysOn Solutions Guide for High Availability and Disaster Recovery
Microsoft SQL Server Analysis Services Multidimensional Performance and Operations Guide
Optimized Bulk Loading of Data into Oracle
Planning Disaster Recovery for Microsoft SQL Server Reporting Services in SharePoint Integrated Mode
QuickStart: Learn DAX Basics in 30 Minutes
SQL Server 2012 Tutorials: Analysis Services - Data Mining
SQL Server 2012 Tutorials: Analysis Services - Multidimensional Modeling
SQL Server 2012 Tutorials: Analysis Services - Tabular Modeling
SQL Server 2012 Tutorials: Reporting Services
SQL Server 2012 Tutorials: Writing Transact-SQL Statements
SQL Server 2012 Upgrade Technical Guide
SQL Server Community FAQs Manual
Visual StudioMoving to Microsoft Visual Studio 2010
Upgrade Team Foundation Server 2012: the ultimate upgrade guide
Web DevelopmentDeploying an ASP.NET Web Application to a Hosting Provider using Visual Studio
Developing Modern Mobile Web Apps
The Entity Framework 4.0 and ASP.NET Web Forms – Getting Started
Getting Started with ASP.NET 4.5 Web Forms (Beta)
Getting Started with the Entity Framework 4.1 using ASP.NET MVC
Intro to ASP.NET MVC 4 with Visual Studio (Beta)
Introducing ASP.NET Web Pages 2
Project Silk: Client-Side Web Development for Modern Browsers
WindowsDeploying Windows 7: Essential Guidance
Programming Windows 8 Apps with HTML, CSS, and JavaScript
Windows AzureAutoscaling Application Block and Transient Fault Handling Application Block Reference
Building Elastic and Resilient Cloud Applications - Developer's Guide to the Enterprise Library 5.0 Integration Pack for Windows Azure
Building Hybrid Applications in the Cloud on Windows Azure
Create Your First Application - Node.js and Windows AzureDrupal on Windows Azure
Migrating Data-Centric Applications to Windows Azure
Moving Applications to the Cloud, 2nd Edition
Using Windows Azure Mobile Services to Cloud-Enable your iOS Apps
Using Windows Azure Mobile Services to Cloud-Enable Your Windows Phone 8 Apps
Using Windows Azure Mobile Services to Cloud-Enable your Windows Store Apps in C#
Using Windows Azure Mobile Services to Cloud-Enable Your Windows Store Apps in JavaScript
Windows Azure and SQL Database Tutorials
Windows Azure Prescriptive Guidance
Windows Azure Service Bus Reference
Windows PhoneDeveloping an Advanced Windows Phone 7.5 App that Connects to the Cloud
Programming Windows Phone 7
Windows ServerA Guide to Claims-Based Identity and Access Control, Second Edition
Introducing Windows Server 2008 R2
Introducing Windows Server 2012
Understanding Microsoft Virtualization Solutions: From the Desktop to the Datacenter, Second Edition
CareerOwn Your Future: Update Your Skills with Resources and Career Ideas from Microsoft

4/08/2013

Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code

Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code

This was really strange (but funny) issue!!

I created few of the InfoPath Forms and published them into the SharePoint 2010 Library.

After a while, I got a request from another Developer asking me for the forms as they wanted to update and make few changes into the existing form. (So I did give them the forms :P )

After a while they come running to me and said that they are getting an error while opening the form and below is the error:
"This form cannot be opened because it requires the domain permission level and it currently has restricted permission."
And another error:

"Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code."

InfoPath Error

Strange!!

Can't a developer just edit the InfoPath form of an another Developer?!?!

I asked the developer to send me the list of steps he is following while trying to open the file (and that's the catch).

What he was trying is "Double-click on the form to open it?!?!?!?!"

Solution: Right Click on the form and Select "Design" :)

Have fun & Enjoy!!

3/06/2013

Displaying attachment link in a SharePoint custom list form – "DispForm.aspx"

Displaying attachment link in a SharePoint custom list form – "DispForm.aspx"

Recently while working with SharePoint lists I required to customize the out-of-the-box list item display form “DispForm.aspx” to present a design-frenzy item view format.

During the modification process, I never assumed that the list item attachments would abruptly dissapear from the display form. All I was looking to do was to display the list item in a good looking format by modifying the XSLT, but the attachments were gone!

Lesson Learnt: Never modify the out-of-the-box list item display form “DispForm.aspx”. Create a new one if you need to and call it “DispForm_WhateverYouCallIt.aspx”

Now the attachments that were gone seemed quite easy to be brought back on the page. It needed a SharePoint control AttachmentsField that went missing from the picture. Below is the code that you need to add into the XSLT template dvt_1.rowview (into your custom form) that constructs theDataFormWebPart that SharePoint Designer creates for you when you insert a Custom List Form:

Infopath cannot save the following form: http://servername..... This document library was either renamed or deleted, or network problem are preventing the file from being saved. If this problem persists, contact your administrator.

Infopath cannot save the following form: http://servername.....  This document library was either  renamed or deleted, or network problem are preventing the file from being saved. If this problem persists, contact your administrator.


This error started appearing every time I try to publish a particular template back to the library.  I've been working with this template all week without any issues until this.  The document library wasn't renamed or deleted.  I can edit and publish changes to form library templates in other site collections without a problem.  This particular form library template does not contain any custom code.
Now in this case, there are couple of things you should try as suggested by Carl G - DC
  • Go to another PC and log-in into windows with your account, then open the template from the library and publish back to the library
  • Open IP Designer on your machine, open an old version of the form, and choose File | Publish | SharePoint Server and choose the same library
  • Clear the InfoPath cache (Start | Run | InfoPath /cache clearall)
  • From IP Designer, File | Publish | SharePoint Server, but this time enter full URL of file path (including the template.xsn)
  • Navigated to Library Settings | Re-link documents to this library, then selected the only submitted document and clicked Re-link All.  Then edit the template and try to publish back to the library
  • Open IP Designer on your machine, open an old version of the form, and choose File | Publish | SharePoint Server and choose to publish to a new library.  Then edit the template in that new library and published again
  • Also try cranking up monitoring for InfoPath Forms Services in Central Admin, repeat the same test of editing and publishing the template and then check the Windows Events Logs on all SharePoint servers in the farm.

2/08/2013

Show Description/Comment History in Display Form of SharePoint Designer 2007

Show Description/Comment History in Display Form of SharePoint Designer 2007

Hey Guys,

Yeah, it seems little weird for me to go back working on SharePoint (or may be MOSS) 2007 but it was for a while  :)

So, when you have a requirement to showing Description/Comments History in your display form, for which, the field was multi line text, what would you do?

1

For Description, it's pretty straight forward!!

<xsl:value-of select="@Comments" />

But for Comments History, in my edit page, I was able to see the Comments History like this:

1

In HTML Code, I show something like below,

<xsl:value-of select="@Comments" />

but nothing comes under the Comments Text in my Display form!!  :(

I went and edited the Edit Form where it does shows the comment history, so how to show the comment history in Display form??

It's simple (looks simple when you know it :) )

Just Changed the below code,

<xsl:value-of select="@Comments" />

To

<SharePoint:AppendOnlyHistory FieldName="Comments" runat="server" ControlMode="Display" ItemId="{@ID}"/>

That's it.

Thanks & Enjoy!! :)

2/06/2013

1/23/2013

How To : Calculate Median Value Using InfoPath Forms

How To : Calculate Median Value Using InfoPath Forms

Thanks To Entan Ming!!

I was going crazy for this untill Entan Ming provided a solution to me.

I wanted to calculate Median for values entered into my InfoPath form (as of now I have provided 10 textboxes in InfoPath but you can modify my code as per your requirement)

Though I have provided 10 textboxes, users can enter less than 10 values as well and I need to count Median for it.

Yes, I know that we can achieve this simply by creating a List with one calculated column and can use =MEDIAN() formula (as simple as that)

But when users want to see the final Median value before submitting the values (for whatsoever reason), you can't use List!!

So, Let's start!!

First of all (if you are not aware of how to do it), check out my post on How To : Code in InfoPath Forms 2010

Once you know what I am talking about (for this perticular code), create 11 textboxes and 1 button and call below method on button click:

Code:

public void sorting()
{
int[] arry = new int[11];
int counter = 0;
for (int i = 1; i <= 10; i++)
{
if (MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field" + i + "", NamespaceManager).Value != "")
{
arry[i] = Convert.ToInt32(MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field" + i + "", NamespaceManager).Value);
counter++;
}
else
{
break;
}
}
int[] resul = new int[counter];
for (int i = 0; i < counter; i++)
{
resul[i] = arry[i + 1];
}
bool sortnum = true;
int pos = 0;
int tot = counter;
int median = 0;
while (sortnum == true)
{
for (int j = (pos + 1); j < tot; j++)
{
int rd = resul[pos];
int fg = resul[j];
if (rd > fg)
{
resul[pos] = fg;
resul[j] = rd;
}
}
pos = pos + 1;
if (pos >= tot)
{
sortnum = false;
}
}
if (tot % 2 == 0)
{
int sdd = resul[(tot / 2) - 1] + resul[tot / 2] / 2;
median = sdd;
}
else
{
median = resul[(tot - 1) / 2];
}
string a = Convert.ToString(median);
XPathNavigator P2 = this.MainDataSource.CreateNavigator().SelectSingleNode("//my:myFields/my:field11", this.NamespaceManager);
P2.SetValue(((Convert.ToDouble(resul[(tot/2)-1]) + Convert.ToDouble(resul[(tot / 2)])) / 2).ToString());
}

You will get Median value (at run time) in your field11 textbox!! :)