Friday, October 5, 2012

Stop a mysite from being deleted

Found this helpful post and am reposting here for my own records:
http://blog.ray1.net/2011/08/stop-mysite-from-being-deleted.html

Issue:
The My Site of [USER] is scheduled for deletion.
The My Site of [USER] is scheduled for deletion in 3 days. As their manager you are now the temporary owner of their site. This temporary ownership gives you access to the site to copy any business-related information you might need. To access the site use this URL: http://mysites/personal/[USER]

Cause:
  • User profile deleted
  • User profile re-imported
  • User profile has its Personal site property missing
There's a Timer Job that runs every hour called My Site Cleanup Job. This job among other things looks at dbo.Profile_DeletedUsers and My Sites that don't have a current user profile association.
When it finds a My Site without a user profile association it adds the site to the dbo.MySiteDeletionStatus table in the Profile DB.

Fix:
  • Ensure the User Profile has the site associated with his account
  • The following query will give you profiles with a My Site.
    SELECT PropertyVal, p.* FROM dbo.UserProfileValue v inner join dbo.UserProfile_Full p on p.RecordID=v.RecordID where PropertyID=22 and PropertyVal is not null
    If the account isn't there you need to go to: Central Administration > Manage User Profiles and add the URL to the Personal site property.
  • Delete the MySiteDeletionStatus record.
    This table has a NotificationStatus column with values 1-3 calculated based on the Created column.
    1 = 14 days til deletion email, 2 = 3 days til deletion and 3 = 1 day til deletion.
    This last step is the only crucial one.
BTW: This theoretically will leave the Db in an unsupported state, because we're not supposed to edit or even query SP DB's directly... so don't tell anyone and no one will know.

Friday, June 29, 2012

SharePoint List Filter Logic

When setting up a list view using a filter, I could not figure out the logic between ANDs and ORs.  Finally found this great forum post that explains it very well.

Here is a short excerpt:

Because the boolean operators AND and OR have the same level of precedence, in order to achieve what you want you need to be able to group the expressions like so:

(Lead Writer = [Me] OR Created By = [Me]) AND (Status = Not Started OR Status = In progress)

However, when setting the filters using the UI, SharePoint adds the filters sequentially, so it will interpret this as something like

(((Lead Writer = [Me] OR Created By = [Me]) AND Status = Not Started) OR Status = In progress)

Thanks to Paul Lucas

Thursday, June 28, 2012

Text Box Double Click Issue

Environment
  • SharePoint 2010
  • InfoPath 2010
  • Web Form
Requirements
  • Form had several text boxes
  • Client wanted OneNote type saving, where every time they change a text box, it saves the form
  • I wanted a no-code solution, so it needed to be done using rules
  • Idea was to add a submit rule to each text box
Issue
  • Everytime they would type in a text box, it would take two clicks to get to the next text box
  • They type into a text box, then click on the next text box, the form would post back and focus would not return to the text box on which they clicked, causing them to have to click again
Resolution
  • Turn off Post Back on the text box
  • Edit the properties on the text box
  • Click on the Browser Forms tab
  • Select Never
  • My initial thought is to use this sparingly.

Thanks to this blogpost for the idea

Wednesday, May 30, 2012

Limited Access Issue Continued

In a previous post, I talked about a user that had limited access to a folder within a document library, but no access to the library, nor the site, and the user was not able to access the folder despite being given access.  Microsoft helped me solve that issue by disabling viewformpageslockdown.

However, the issue persisted on a couple of sites within the site collection, even though the site collection at large was fixed.  The only commonality with the sites that were still having problems was that I had used Metalogix Migration tool to copy the entire site over to the new environment from SharePoint 2007 to 2010.  Most of the other sites, I used the tool to copy data (i.e. lists and libraries), but not the entire site.  I had setup the site on the new environment and copied information into it.


After a lot of frustrating poking around, I noticed this within permission levels for the site:




If you go to Site Permissions for the particular site, there is a Permission Levels button that takes you to permission levels for the individual site.  I clicked Inherit Permission Levels and it fixed the problem for that site.  After clicking that, the Permission Levels button disappeared for that site, now I can only access permission levels from the root site.

Thursday, May 17, 2012

Profile Import Issues - Helpful Blog

Pictures weren't importing into SharePoint and I found this blog post to have some unique insights
http://blogs.technet.com/b/harmeetw/archive/2011/09/10/importing-thumbnail-photos-from-ad-active-directory-into-sharepoint-2010.aspx

This is an extract from the end of the blog:

Troubleshooting:

How to find if an image for a user has been imported in Sync DB
Select sAMAccountName,SPS_MV_OctetString_PictureURL from MMS_Metaverse Where SAMAccountName like '%UserName%'

How to find if an image for a user has been imported in Profile DB
Select NTname,PictureURL from UserProfile_full where NTName like ‘%UserName%’

We first import images from AD into Sync DB and then populate it into the Profile DB. By default images do not auto populate in Profile DB,we need to run the following CMDlet

Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://mysite

Image type issues
Best way to troubleshoot this issue is by creating a simple JPG file from MSPaint and then upload it to the Active Directory, if this comes through then you will need to check out the file types or the size issues.

Wednesday, May 16, 2012

Powershell - Creating a SharePoint Group w/Another Group as Owner

I wanted to create a SharePoint group on a site collection with:
  • No rights to any sites, just create the group
  • A sharepoint group as the owner of the new group
  • Done using Powershell
$siteURL="http://sitecollection/"
$webName = "sitename"
$spWeb=$spSite.OpenWeb($webName)
[Microsoft.SharePoint.SPMember]$GroupOwner = $spWeb.SiteGroups["Group Name"]
$newGroup = $spWeb.SiteGroups.Add("Group Name", $GroupOwner, $null, "Description")

For reference, you could replace the $null with a user that you would like to be a part of the group

I think that's everything, I pulled everything I thought was necessary from a much larger script.

Tuesday, May 15, 2012

InfoPath form Migration

I needed to move a bunch of InfoPath forms from one library to another, because I re-created the infopath template on a new server.  I needed to preserve the historical data, however, the individual forms (XML Files) reference the old library, so I needed to change all of the URLs in all of the XML files to point to the new server. This script allowed me to do that.

$files = get-childitem .\ToDo

foreach ($file in $files){
     (Get-Content c:\XmlFiles\ToDo\$file) |
     Foreach-Object {$_ -replace      "http://OldSiteCollection/Path/Forms/template.xsn",      "http://NewSiteCollection.com/path/Forms/template.xsn"} |
     Set-Content c:\XmlFiles\Done\$file
}

I copied all of the InfoPath forms to a directory (c:\XmlFiles\ToDo) on my computer and created an output directory (c:\XmlFiles\Done), then ran the script.