Category Archives: SharePoint

Delete a site collection from SharePoint Online

Do you need to delete a site collection from SharePoint online?

Do you want to re-create it afterwards?

You’ll need to delete it, then remove it from the recyclebin, but you can’t do that from the gui.

Using Powershell,

1) connect to your SPO admin tenant.

2) Get a list of your deleted sites in the site collection recycle bin with:

Now create a statement to get just the one you want:

Does that return just one?

If so,  hit the up arrow on your keyboard, then the end key, now add some text until your line looks like this:

 

 

 

Quick Powershell script for connecting to SharePoint Online/ Office 365

At work, we’ve started working with Sharepoint online/ O365, and it’s a bit tedious to type in the whole connection command each time.

I wanted a simple script that would store the name of our tenant, my username, and would then securely prompt me for my password:

 

Start off 2015 by fixing a messed up edit page in SP2007…

It’s the start of 2015…

Who needs the cloud, SP2013 or even SP2010! It’s time to get sucked into a support issue on a legacy SP2007 site 🙁

One of our legacy SP2007 sites had a custom list with an edit page that got corrupted.

Seems a user might have edited the edit page, and removed the web part that makes the edit page an edit page.

The solution wasn’t exactly quick or easy – I hadn’t worked with SP2007 in a long while and neither did our support engineer at Microsoft.

We ended up solving the issue ourselves.  We have 3rd tier support with Microsoft, which has been great on the 2010 and 2013 side, but in this case the product in question is 2007 and I can’t say I blame Microsoft if all the people who were good at 2007 have moved on to other things by now.

Here’s a rough outline of what we did:

1) The EditForm.aspx page was broken

2) A known good DB backup of the site was recovered in a test environment  – this had a good copy of the form.

3) The good working list in the test environment was saved as a template with and without data in the test environment. The STP file was then copied to production

5) In production, in the same sitecollection/subweb, a new empty user list was created, using the template file that was imported from the test environment. One test record was created (ID=1) so that we could validate that the restored, empty,  list worked.

6) SharePoint designer had to be enabled on production – it was found to be disabled via the onet.xml file for the STS template http://support.microsoft.com/kb/940958

7) Using some of the ideas from this article: http://hightechdave.com/recover-newform-aspx-from-the-dead-in-sharepoint-2007/

8) Editing the HTML of the broken EditForm.aspx in SharePoint Designer 2007,  We copied the webpart section from the restored ‘good’ list over to the ‘bad’ list. Note: this MUST be done in SharePoint Designer – editing the files from explorer will not work because part of this file is stored in the content database.

9) Saved the broken EditForm.aspx list and looked at it – it worked but referenced data from the new ‘good’ list (I had to construct the edit URL by hand, based on the edit url of the restored list, since the edit links on our allitems page were also broken…)

10) Edited the broken EditForm.aspx and also opened the newform.aspx page from the same list (the original list with the problem) in SharePoint Designer’s ‘code/html’ view.

11) Copied the guid from the NewForm.aspx to the EditForm.aspx

12) Saved it and looked at it.

13) Edited the broken EditForm.aspx in SPD and changed the title in the webpart to the name of the list –

14) Saved it and it was fixed.

Note some things that did not work:

The article mentioned using a new GUID – that failed for me.

Also, when I pasted the webpart code in AND changed the list guid AT THE SAME TIME – it did not work. It seemed I needed to save it after pasting in the list, then go back and edit it.

And last but not least, I remember having to change the title on the webpart (via SPD’s html editor) before the webpart displayed correctly. And I think there might be a chance that doing it at the same time as another change didn’t work – for all I know it would have/should have and I just made a mistake when I tried to do it all at once, but it definitely worked when done as described above.

Ok time to get back to 2015 and start working on some SharePoint Online initiatives!

– Jack

Sync an Active Directory Group with a SharePoint Group

Have you ever wanted to keep the members of a SharePoint group in sync with those of an Active Directory Group?

If so, you’re in luck, I happen to have just such as script.

Just a quick note, this was written for and tested on a 2010 site – in 2013, the default authentication is Claims – those funny looking strings like this: “i:0#.w|domain\user” (more info here) and you’ll need to work this script over a few times to make that work.

That said, this script will keep a SharePoint group in sync with an AD group.

The AD group is considered the “master”

That is to say, if the AD group has extra users that aren’t in SharePoint, they will be added to SharePoint.

If a user is removed from the AD group, they will also be removed from the SharePoint Group.

If a user is added to the SP Group, but isn’t in the AD group? They will be removed from the SP group.

This is one of those scripts that makes sense to run as a scheduled task once you get it working.  If you need help with that, see my post: Schedule your PowerShell scripts using the Windows task scheduler.

Now for a friendly reminder and some advice…
#1) Always test code you find online before using it in production…
#2) when you test this code, follow this advice:

Testing this code

When you test the code, you might make a mistake I made during development – I’ll share that mistake with you to save you an hour of time and some frustration.

Here’s what I did…

While testing, I wanted to try adding users to an AD group and wanted to make sure they added in correctly.

For one test I wanted to remove ALL the users from the SharePoint Group, and confirm that they came back ok.

To do this I used the UI to remove all the users – I checked each user, then clicked “actions->remove users from group” like this:
removeusersscreenSP2010

I then ran my Super Awesome AD Sync PowerShell Script which Added the groups back in.

Now here’s where it got ugly.

When I checked the UI, they weren’t there.

In fact, if I ran the powershell script again it indicated that they were being added back a second time (the script should have told me there was nothing to change!)

What was the cause?

It was my use of the refresh button…refresh in IE

Recall that the very last thing I did was remove users using that screen.

Now interestingly, you know how we all click “OK” on a screen without paying attention?

After I hit refresh, I got this, and ignored it:
dialogIshouldhaveread

See what I did there?

I was refreshing the delete in the UI!

Don’t make that mistake!

Instead of clicking the refresh button, it’s easier (and safer) to click the group name on the left:
dontclickrefreshwhenyoudelete

Lessons learned:

  • Pay attention to dialog boxes, they may save you an hour.
  • Don’t ever click ‘refresh’ after performing a delete!

 

Is ‘SharePoint Online’ becoming ‘Office 365 Sites’?

There’s been a bit of chatter for some time now about the future of SharePoint.
An article over a year ago portrayed SharePoint as a technology Stack, much like .net

I couldn’t help but notice in my office 365 site, that SharePoint “Sites” aren’t actually branded “SharePoint” in the panel now:
Office365Portal_Dec_12_2014

See that?
Every other branded product has its brand name.
We see “Excel Online” not “Spreadsheet”
OneDrive is there.
So is Delve

And both PowerPoint Online and and OneNote Online use two lines to describe what those do.
In fact, there are exactly the same number of characters in the word “PowerPoint” as there are in “SharePoint”

Lets look at one more thing…
See that tile with the “V” – that’s not Visio, it’s Video, you know, Office 365 Video:

Office365VideoTitle

Now, if “Video” by itself means “Office 365 Video”, does it follow suit that “Sites” by itself means “Office 365 Sites”?

Lets look at a few more things in the o365 interface.
When I clicked on “Sites” the first time, I got this screen:
Office365Sites_screen1
Now here we can relax, Microsoft hasn’t rolled Sites into OneDrive. If you note the url, you’ll see it’s going to a mysite location. It’s the first time I’ve used this tenant, and mysites have never been setup for the user that I’m using.

After the mysite was setup, I went back to the first screenshot, and again clicked on the “Sites” link.
This time I came here:
Office365Sites_screen2
Now lets take a moment and examine that screen shall we?

  • There’s no mention of SharePoint…
  • Those familiar with the SharePoint 2013 branding might recognize the “S>” logo.
  • Those familiar with SharePoint infrastructure might notice that the URL is a SharePoint MySite.

If that’s a mysite, maybe the “team site” is different?

Curious, I had to create a standard old “team site” and see what it looked like – I did this in the SharePoint online admin panel (yes that’s still there, under the hood) Note, that I did this before the above screenshot was taken, which is why you see “Public Site” and “Team Site” in the screenshot.

Ok so what does a “Team Site” look like?
Office365Sites_TeamSite

See the word SharePoint anywhere on that screenshot?
I didn’t think so.
I even brought down the settings menu to see if there was any mention of it. (no)

Times they are a changing. If I didn’t know any better, I’d say that the SharePoint Brand Name is on it’s way out.
Is it time to rethink the “SharePointJack” brand as well?

Discrepancy between SharePoint Online Recycle Bin and MS’s stated 90 day retention policy

In Office 365 Sites / SharePoint Online, deleted objects are supposed to hang around for 90 days.

While playing around with SharePoint Online I deleted a site collection, then went and had a look in the SharePoint Online admin portal. I was a little surprised to see that it showed that it only had 30 days to live – that’s a lot less than the 90 that MS states.

I searched the net, and confirmed, it is in fact supposed to be 90 days.

It turns out that between day 30 and 90, you must use powershell to recover a deleted SharePoint Online/o365 site.

The commands to do this are fairly straightforward:

Now the above commands will get you connected to SPO, and then show you what sites you have that are deleted.
If you only have one site, you can just pipe the output to Restore-SPODeletedSite

What if you only want to restore one site?
Just use “where”
Here’s a full example:

Slides from SPFest Chicago 2014 SharePoint PowerShell Time Machine Session

I presented a session at SPFest Chicago titled: SharePoint PowerShell Time Machine.

A big thank you to everyone that attended!

The Slides and scripts used in that session are attached below:
SharePoint PowerShell Time Machine.pptx
SharePoint PowerShell Time Machine Scripts_Jack Fruh Sharepointjack.com.zip

If you are just getting started with PowerShell, the cheat sheet is a GREAT place to start! It’s 6 pages of very short form info about PowerShell:
Combined PowerShell and SharePoint Cheat Sheet

I look forward to hearing how you’re using PowerShell to save time!

– Jack

PS. If you download the scripts, you might find you have some trouble running them – Windows will sometimes tag the files as ‘downloaded’ and you’ll need to untag them before you can run them.

If all else fails, you can always open in notepad, and copy/paste into a new file.

– Jack

Note: Bamboo solutions did a write up of the session and put it on their blog:
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2014/12/10/sp-fest-chicago-jack-fruh-s-sharepoint-powershell-time-machine.aspx

Slides from SPFest Chicago 2014 SharePoint PowerShell Workshop

I did a PowerShell workshop with Michael Blumenthal today at SPFest Chicago.

The main slide deck is attached below, more to follow.

Introduction to PowerShell – Be a PowerShell Hero – SPFest 2014 Workshop

If you were at the session, thanks for attending!
If you missed it, thanks for looking up the slide deck!

Either way I look forward to hearing how you’re using PowerShell with SharePoint!

– Jack

I’m Moderating a free webinar on Branding on Thursday October 23rd 2014

Come join me and a 3 awesome SharePoint MVP’s this Thursday 10-23-2014 at 11am CST for a talk about the Role of Branding in the future of SharePoint.

Join myself and John Ross, Randy Drisgill and Yaroslav Pentsarskyy for an interesting discussion on branding, complete with the latest best practices..

Our expert panel will answer questions about

  • How Branding differs between Online and On-Premise.
  • The Role of Responsive Design in Modern Day SharePoint Branding
  • The latest guidance from Microsoft as it relates to Branding Office 365

Plus as many audience questions as we can answer in 60 minutes!

I hope to see you there!

Register at:
https://www1.gotomeeting.com/register/509215617

– Jack

I’m presenting at SPFest Chicago – December 8th-10th 2014

I’m excited to be a part of SP Fest Chicago 2014 this year with two sessions:

“SharePoint PowerShell Time Machine”
On Tuesday December 9th at 11:20am.

In this session I share scripts that will either save you time, or in some cases, allow you to go back in time. For example, there’s a script that enables versioning on every document library in your farm. Another that logs basic permissions, and as many other handy scripts as I can fit into a 70 minute session!

“Advanced Introduction to PowerShell Scripting”
On Monday December 8th 8:30am-Noon with co-host Michael Blumenthal

This 100-200 level half day workshop will introduce you to PowerShell in a way that you can use the very next day at work. We’ll quickly cover the basics of PowerShell, then demonstrate some real world scripts used to solve day to day problems in the life of a SharePoint Administrator. We then deconstruct a script- and show you “how we figured it out” – showing the process of starting a script from scratch, and the explorative process used to figure out what to put in a script when you have no idea how at the beginning (and without using Google!) Along the way we explain and demonstrate the features of PowerShell that make things fun! There is something for everyone – new PowerShell users will be on the fast-track to using PS in day to day work. more experienced PS users benefit from seeing real-world scripts and hearing how others go about solving problems. We even have a few tricks that will save time for developers! 

I hope to see you there!

– Jack