Category: SharePoint 2010

Cant use SPContext.Current.Site in Sandbox Feature Receiver

By , August 11, 2011

This may be common knowledge to you Sandbox Solution pros out there, but I banged my head against it for a while today and felt like sharing.

I was attempting to grab the current site using SPContext.Current.Site like I normally do, but I kept getting the generic Sandbox error tell me I was outside the confines of my sandbox.  This seems to only occur when dealing with feature receivers, but I am not positive about that.

As a work around, you can get the current site through the properties object as such.

SPSite siteCollection = properties.Feature.Parent as SPSite;

Happy coding!

Huntsville AL SharePoint User Group Presentation on BI

By , April 21, 2011

This past week I presented on Microsoft Business Intelligence at the Huntsville SharePoint User Group, now officially known as the Rocket City SharePoint user Group.

In the presentation I went over the three main SQL Server Components (SSIS, SSAS, SSRS) and PerformancePoint.  Then we went through a live demo of importing some data into SQL Server with SSIS, building a data cube on it with SSAS, and making reports in SSRS and PerformancePoint.

The entire presentation lasted about an hour, and luckily didnt have any major hiccups.

Click here for the presentation (8 MB)

Making Custom User Profile Properties Searchable in SharePoint 2010

By , October 11, 2010

SharePoint 2010 allows for the creation of custom user profile properties in much the same way 2007 did.  This allows a company to tailor user profiles to fit their unique business needs and better promote social networking in the enterprise.

One issue I recently ran into with this however appeared when I tried to search on these new custom properties.  It so happens, that SharePoint does not automatically tie these new properties into the search experience, even if you mark the new property as one to be indexed.  I am going to walk through the steps required to create a new user profile property and make it appear in SharePoint 2010’s people search so hopefully someone else doesn’t waste as much time as I did getting this to work.

For this example I am going to create a Property called “Previous Customers” that lists all of the customers a person has worked with in the past.  Note that in my case this is a multi-value property, so make your selections accordingly.

Part 1 – Creating a Term Set for the Profile Property (This will store all of the Previous Customers entered by the users in a nice, clean set that is then reusable)

1)      Navigate to the Managed Metadata Service Application in Central Admin

2)      Create a new group for Profile Property Term Sets

3)      Create a new Term Set for the Profile Property you are about to create

Part 2 – Creating the Profile Property

1)      Navigate to the User Profile Service Application in Central Admin

2)      Click on “Manage User Properties”

3)      Click on “New Property”

4)      Fill out the information requested in the dialog box, selecting the term set created in Part 1.

5)      Make sure you select the Indexed check box

Now if you go to a user profile you should see the new property you just created.

So, at this point you may think (I did) that since you clicked the Indexed box, this will be indexed and make people appear in the People Search Results… Wrong!  We still have quite a bit of work to do.

Part 3 – Setting up the Metadata Properties in Search (This is kind of the tricky part)

1)      Navigate to your Search Service in Central Admin (Fast Query Service if using FAST Search)

2)      Click on Metadata Properties

3)      First make sure your Crawled Properties are there – Click on “Crawled Properties” (You may need to do an incremental crawl before they show up.)

4)      Do a search for your term (In my Case, PreviousCustomers – Results are shown in the image below)

5)      You should have two properties, one beginning with “ows_taxId” and the other starting with “People:” – If not, do an incremental crawl and try again, also make sure you filled out at least one profile with some sample data.

6)      We need to create a new Managed Property to map your custom user profile property to, so click back a couple of times and click on “New Managed Property”

7)      Fill out the resulting dialog box, mapping it to your Crawled Property – my example is shown below.

8)      Now go back to your crawled properties and  set their mappings per the image below

a.       Select ContentsHidden as a mapping for your People Attribute

b.      Do not select Included in Index in either one

Now if you kick off a crawl you should get some results back when you perform a search.  What this looks like is shown below.

So, you should notice that while you get a result back (I have “City of” as one of my previous customers) is does not display your custom field in the results.  To correct this we need to modify the xslt in the people results web part.

I hate editing xslt, but find it pretty easy if you copy some of what is already there.  Past Projects for example is an out of the box profile property that is like mine (Multi-Valued, appears in results, text, etc.) so wherever I saw PastProjects in the xslt, I copied that section with my term PreviousCustomers.

Part 4 – Modify the XSLT in the People Search Results Web Part

The three additions are below… I suggest using Visual Studio or something to edit the xslt other than the browser – much easier.

Add A Parameter (I Didn’t end up using this, but added it anyway)

<xsl:param name=”PreviousCustomersLabel” />

Declare a variable

<xsl:variable name=”haspc”        select=”($FilterNodeSet and $FilterNodeSet/@title=’PreviousCustomers’) or hithighlightedproperties/previouscustomers/@hashh &gt; 0″/>

 

Add an If Statement to display the Property

 

<xsl:if test=”$haspc”>

<li>

<span id=”FieldTitle”>

Previous Customers:

</span>

<xsl:call-template name=”RenderSimpleMultivalue”>

<xsl:with-param name=”multivalue” select=”hithighlightedproperties/previouscustomers”/>

<xsl:with-param name=”cutoff” select=”5″/>

</xsl:call-template>

</li>

</xsl:if>

 

The end result is what you wanted to begin with, your results being shown and the proper section being highlighted.


Excel Files in SharePoint as Data Sources in SSIS 2008

By , October 5, 2010

I ran into a problem this week when I wanted to use an Excel file located in SharePoint as a data source in a SSIS project.  I had done this before in SSIS 2005, but 2008 turned out to be a little tricky.

The problem I was having was that SSIS could not find the excel file, and through tinkering around gave me several different error messages.  I then noticed that I couldn’t browse the sharepoint files via UNC Paths ( \\servername\sitename\library ) from the server, but I could from my desktop.  (Note that I am developing on the server, Windows Server 2008 R2, instead of on my desktop – maybe that was the problem to begin with.)

This led me to check on the WebClient service, which was not even listed let alone not started.  So, after a little digging it seems that you need to enable the Desktop Experience Feature in Windows Server 2008 to install the WebClient feature, which then lets you connect to SharePoint via UNC paths.  After that was installed and the service was started, I was able to connect to my excel file like normal.

Hopefully this can save someone some time and frustration.

SharePoint iPhone App Roundup

By , July 12, 2010

So, I just got an iPhone 4, upgrading from an old windows mobile phone, and decided to investigate what apps were out there for SharePoint.  Oddly enough, I couldn’t find a blog comparing what was available, so that is what I am doing.  I downloaded and tested everyone I could find in the App store, with the exception of one that had a server side component.

Below are the applications I tested, along with what i felt were the pros and cons of each.

My choices:

The best free app is I-Share, as it is the only one that lets you edit list data, and I feel that is a very important feature.  That said, if SharePlus’s next version (2.0) comes out and offers the edit capabilities it is promising, that would likely be my number one choice for a free app.

The best paid app has to be PocketPoint, again because it offers edit capabilities.  And for 5$ it inst overpriced unlike the paid version of SharePlus.

Happy Apping!

Moshare – Free

http://moprise.com/ 

Good Bad
Strong interface for documents No support for custom lists 
Easy to email documents or links to documents Cannot edit data
Can open and display documents Search doesn’t seem to work
Decent for viewing contact lists and documents  
Good calendar support  

 

SharePlusLite – Free.  10$ version provides offline sync of documents.  Next version is supposed to add edit capabilities to both free and paid versions

http://itunes.apple.com/us/app/shareplus-office-mobile-client/id364895421?mt=8

Good Bad
Ability to View Custom Lists Cannot edit data
View of lists shows multiple fields, not just title Search only finds subsites and lists, not items
Supports Multiple Views of Lists  
Can open and display documents  

 

IShare – Free

http://spyk.com/Products/iShare/Pages/iShare.aspx

Good Bad
Ability to View Custom Lists When viewing list: Only item’s title is displayed
Ability to edit data in lists Can only view lists by default view
Search includes all site content  
Can open and display documents  

 

PocketPoint – $4.99

http://endurosoft.com/Products/PocketPoint.aspx

Good Bad
Ability to View Custom Lists When viewing list: Only item’s title is displayed
Ability to edit/delete/create data in lists Found a couple of small bugs 
Search includes all site content  
Can open and display documents  
Easy to email/download documents  
Can switch between views of lists  
File sharing feature shares files on iphone  

Attache – $0.99

http://www.lucruminc.com/attache/

Good Bad
Ability to View Custom Lists When viewing list: Only item’s title is displayed
Good for viewing contacts Cannot edit anything
  No Search
  Cannot open documents

 

ISP-Browser – $0.99

http://www.isp-apps.com/

Good Bad
Ability to View Custom Lists When viewing list: Only item’s title is displayed
  Cannot edit anything
  Poor design