Categories
Server

Upload a .STP Template File

This is a quick way to programmatically upload a .STP template file within SharePoint using PowerShell – useful if you’re transferring list templates from a development to a live environment.

$web = Get-SPWeb "http://mydomain"
$folder = $web.GetFolder( "List Template Gallery" )
$files = $folder.Files
$file = Get-ChildItem "C:\MyListTemplate.stp"
$newfile = $files.Add( "_catalogs/lt/MyListTemplate.stp", $file.OpenRead(), $true )
$web.Dispose()
Categories
Server

Sharing permissions for Authenticated Users

Note to self: When setting permissions and sharing content stored within SharePoint 2013, Microsoft have now hidden the “All Authenticated Users” option that was present in 2010. To get around this, just type “NT AUTHORITY\AUTHENTICATED USERS” and click the Share button.

Categories
Server

“Access Denied”

Every so often I receive a helpdesk call from a user who, although their account is a member of the SharePoint site’s Owners, Members or Visitors group, is still presented with the generic “Access Denied” page when they attempt to visit the site.

After a bit of Googling, I found this post that seemed to have the answer.

The trick is to flush the user’s access permissions and recreate them. This can be done by:

  1. Remove the user’s account from the SharePoint group.
  2. Add the account into the Site Collection Administrators group (Site Actions > Site Settings > Site collection administrators).
  3. Remove the account from the Site Collection Administrators group.
  4. Add the account back into the original SharePoint group.

Seems to do the trick!

Update: 4 September 2013

If the above fails to work, you can also try completely removing the user’s profile from the Site Collection.

  1. Open an existing group, e.g. Owners. Its web address will be along the lines of http://domain/_layouts/people.aspx?MembershipGroupID=4.
  2. Change the value for the MembershipGroupId parameter to 0.  This should display the People and Groups – All People list.
  3. Locate and delete the troublesome user from the list (Actions > Delete Users from Site Collection).
  4. Add the deleted user back into the necessary group.
Categories
Announcements Coding

Oops! Twitter Feeds Now Working

I missed the June announcement from Twitter informing everyone that their API v1 was about to be retired – meaning that feeds on my homepage had been failing to update.

Along with the introduction of rate limits and ditching support for RSS as a response format, API v1.1 has implemented OAuth 2.0 for its authentication. Its not the most straight-forward thing to get your head around, but I found a useful post on CodeForest that helped me to update my own WordPress widgets.

Categories
Things of interest

Nexus 7 Refusing to Charge

I love my Nexus 7. I’ve had it around 10 months now and use it, pretty much, all of the time without trouble. However, every now and then I forget to plug in the charger and the battery goes completely flat. When that happens I’ve had a problem charging it – you can plug in the charger, leave it for a day or two, and… nothing. It doesn’t seem to have charged at all. This blog post seems to give the answer – which I will try the next time it happens.

1.  Plug-in your dead N7 to a wall charger. (Jump immediately to step 2.)

2.  Immediately after plugging it in, press Volume Down and Power at the same time.

*This should get you into the bootloader menu. You may have to try this with different chargers or test out the timing in order to get it to work.

3.  Once in the bootloader menu, use Volume Down until you see “Power Off Device.”

4.  Choose that option with the Power button.

5.  Once your device is off, unplug the charger and then plug it back into the device.

6.  You should now see the battery meter (pictured above) with your device returning to life.

Categories
Server

Windows Server 2008 Disk Cleanup

SharePoint Central Admin has been prompting me, each time I’ve logged in, that one of my drives is running out of space. To be honest, there isn’t a lot that I can do – a small initial system drive and successive Windows updates have gradually eaten away at the free space – but I needed to free-up what I could.

The default install of Server 2008 doesn’t come with a disk clean-up option. You would normally have to install the “Desktop Experience” feature to get this option.

Handily, I found this post from Microsoft: Disk Cleanup option on drive’s general properties and cleanmgr.exe is not present in Windows Server 2008 or Windows Server 2008 R2 by default

Categories
Server

Downloading Solutions from Central Administration

This is a handy little PowerShell snippet that I needed to use today. There were two .WSP solutions installed within the SharePoint farm and I couldn’t locate the original source code.

$farm = Get-SPFarm
$solution = $farm.Solutions.Item("MySharePointSolution.wsp").SolutionFile
$solution.SaveAs("C:\MySharePointSolution.wsp")
Categories
Coding

CSS and Nested Border-Radii

Now, this is an issue I’ve stumbled across while putting together CSS for websites.

You have two elements, one nested within the other, and both have rounded borders. Unless you get the radius of the nested element just right, you’ll end up with a nasty looking ‘hump’ where there should be a nice smooth curve (See Chris Coyier’s post for a visual example).

Fortunately, Joshua Hibbert has blogged about the problem, documented the math­em­at­ical for­mu­las and even coded a tool for the job. Great!

Categories
Coding Server

Hiding SharePoint WebParts via Code

Another note to myself…

When wanting to programmatically hide a WebPart, don’t try to set it’s Visible property to False. This will cause you lots of trouble and create errrors. The correct method is to set its Hidden property to True.

if (items.Count == 0)
{
   this.Hidden = true;
   return;
}

 

Categories
Server

Set Up Groups for this Site

Note to self: Once a site has been created within SharePoint 2010, the ‘Set Up Groups for this Site’ admin page is hidden away – but you can set access it via /_layouts/permsetup.aspx.