Tuesday, 8 September 2015

SharePoint 2013 Powershell Script for getting all Site collection Users


I had to find all the users of a site collection and write to a file,  to add to another site. I was looking for one but couldn't find any, this script will dump all the users into a file with a semicolumn so it will be a straight copy paste.

Download-
http://1drv.ms/1PYONI8

Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null
$SiteCollectionURL = "http://You site/collection name"
$site = new-object Microsoft.SharePoint.SPSite($SiteCollectionURL)
$web = $site.openweb()
$siteUsers = $web.SiteUsers

foreach($user in $siteUsers)
{

Write-Host "Site Collection URL:", $SiteCollectionURL
if($user.IsSiteAdmin -eq $true)
{
Write-Host "ADMIN: ", $user.LoginName 
}
else
{

  <# This will append all users on to a Text file 
  Add-Content c:\userlist.txt  $user.LoginName -Append #>

  <# This will append all users on to a Text file with no newline
  $user.LoginName | Out-File c:\userlist.txt   -nonewline #>

  <# Another way to output the file
  Write-output $user.LoginName  | Out-File c:\myfile.txt -Append #>

  <# This will add all the user on a Single line with a semicolumn so that you can directly reuse this with no formatting #>

  $alluserlist +=  $user.LoginName + ";"
}
}

<# Showing the set of userd and writing the users to a txt file #>

  Write-Host $alluserlist
  [system.io.file]::WriteAllText("C:\io.txt", $alluserlist)
$web.Dispose()
$site.Dispose()

Thursday, 30 July 2015

Sorry we can't seem to connect to the sharepoint store

For those who are desperate to fix the SharePoint 2013 SharePoint Store issue, read on -

I had the same issue and i followed the article on the msdn to set up the store, all services started , configured the service application, set up the DNS however still SharePoint store saying "Sorry, we can't seem to connect the SharePoint store, Try again in a bit" .


If you are in the same state and if you are sure you have done everything else then start suspecting the proxy server. In my case the request which was going out from the SharePoint webfront end server was getting denied by the proxy server.

I took a fiddler trace and it started showing, 401 http error stating response header is 401 Unauthorized Header -




To prove and scope this again, give a simple test, Add a RSS webpart and configure an RSS feed on your SharePoint site and see if it is bringing in any results, if you are getting proxy errors then scope the problem more towards proxy server.

I did the same and i got the below error on my RSS webpart -




To resolve the proxy error I did the below things -

1) Add a proxy rule in the Proxy server (Your Server team should help you here) to allow the SharePoint webfront end servers to access Internet unauthenticated -

I added the below rule, this article will help you in configuring -
Proxy Configuration

Configure ISA/TMG to allow unauthenticated traffic to the Internet. Just add a rule which allows the SharePoint frontend server to navigate to the Internet (network External) over port 80.  Rule settings:
Action: Allow

Protocols: HTTP (80)

From / Listener: hostname of your frontend server

To: External (Internet)

Once this is done checked the RSS feed webpart, for me it was still not working.

 So went to the Sharepoint 2013 webfront end servers, Browser > Internet options > Connections > Lan Settings > Unchecked all options to ensure the requests are not going through any proxies on both the servers.

That made it work, the RSS Feed webpart started working now.
I checked the SharePoint store, viola !! it also started working !!

Note: Please make sure you access the SharePoint store from the Site collection level and not from Central Admin as it always gives you error.



Wednesday, 15 October 2014

SharePoint 2010 Menu Customisation

Here is an awesome menu customisation for SharePoint 2010. I used the Css to make it look like on the screenshot, i have uploaded the Css and the image file which you can download.

This post is basically an excerpt from the blog , i am reposting it. Link

Sometimes it’s the small details that matters most and makes the difference. This post is about how to customize the look and feel for the global navigation, one important element in the SharePoint interface. The navigation control renders a fairly deep HTML structure with a lot of classes to keep in mind when you need to set your branding on the top of it. Recently I built an Intranet branding where the agency had the desire to include a small arrow for selected links in the navigation. This CSS do also take care of drop downs, in the case you are using that. I hope this could be useful for you if you need to include graphics, like this arrow in the global navigation.

Tuesday, 22 July 2014

SharePoint Scrolling Announcement/ News Scroll for 2010/2013

I been asked to create a scrolling announcement for one of my SharePoint 2010 website and  thought it was straight forward however googling for a while i realised many solution have lots of script to be done and some not working, i finally found an easier way to do the same; i have spend many hours to make this happen, by posting this hope will save some of your time.

How does this work ? This uses Content Query webpart and fetch data from Announcement list (Yes any number of announcements can be scrolled) and will display on the site, Here is a screenshot -


If you like it and would want to implement it here are the  steps -

[I have done this and tested on SharePoint 2010 and IE 11/Chrome]

Step 1.
Create an Announcement list or use the one which is already in the SharePoint list (You can create any list as you wish)

Step 2.
Add a CQWP and fetch the item to display- in my case i set a new field called "Show Scroll" and in the CQWP filtered the items if set to Yes























Step 3.

I have added a new CQWP template as in the article - http://sharepointlogics.com/2014/02/sharepoint-2010-content-query-web-part.html editing the itemstyle.xsl. I have added "MarqueeTitleOnly" as the last template above  -

You can find that in the download code Link here -  http://1drv.ms/1jTqn7J

Find the edited item.xslt where i added a new template in the end, update yours appropriately -






Step 4.

Once after set the CQWP to use the new template you created  - 



That's all, set the CQWP with appropriate width so that it shows a scroll button on the right.

Now you have a kool news ticker/Scroller webpart which picks news from Announcement list and shows it on your HomePage....

Friday, 18 July 2014

How to Import Excel Spreadsheet to Lists in SharePoint 2010 / 2013

 Users asking you they have large data in Excel and want to import it into SharePoint; You might have dealt with it at least once if you are in SharePoint.

The primary option will be to import data onto SharePoint by creating a custom list from the Spreadsheet as said on this link - MS Link; there could  be situation where the list is already present and you want to update the data or not follow this approach and then you might think about the SharePoint Datasheet view

However this approach also have several limitations as the excel sheet values should need to be of the same datatype again SharePoint Datasheet view have some restrictions on columns with "Multiline columns" as  and so on... Now what is the best way, i was trying different things and nothing much was helping me out until I found the MS Access way  :)

Yes if you have MS Access service enabled on your farm you have a better and easy way to bulk upload data onto SharePoint in easy 4 steps, Here are the steps
[I have used MS Access 2010 and SharePoint 2010, Access Service enabled on SharePoint farm]

Step 1.
Open MS Access on your client machine > Select All files > MicrosoftSharePoint foundation ()





















Step 2.
Specify a SharePoint Site > Select  > Linked to the data Source by creating a linked table > Click Next



























Step 3

Select the Table which you want to import data > Click OK



























Step 4

Access will create a table which is linked on to SharePoint and you can easily upload, export or manage any data's and SharePoint list will be synced and updated immediately.



















Hope this helps.... Happy SharePointing....