August 14, 2011 - 13:00, by Dostalek, Kevin
Thanks to everyone that came out for my session at SharePoint Saturday "The Conference" that took place this past week in Washington, DC.
I only did one session this year, entitled, Creating a Custom Gatherer for the SharePoint 2010 Activity Feed. As promised you can download a hi-res image version of the 3D-animated mindmap that was used in the presentation by clicking the thumbnail below:
In addition here is the Visual Studio project for the Twitter Gatherer Timer Job. And lastly, here are links to some of the resources we talked about during the session:
The conference itself was pretty epic. 200+ sessions over 3 days time with experts from all around the world. As always my favorite part of attending one of these conferences is interacting with everyone. It was great catching up with old friends and meeting loads of new ones! The SharePoint community is so special and it's amazing to see people sharing their "art" with each other. It doesn't matter if you are hanging out with an SP rockstar or just someone that is passionate about their work-- it such a cool opportunity to learn, grow, and of course SHARE.
In the geek-irony category, I thought it was hillarious that a group of us ended up at a bar/club one night down in DC called "The Frontpage".
Thanks to everyone that made the conference possible, especially the organizers- they did an amazing job!
July 21, 2011 - 14:45, by Dostalek, Kevin
So today I was in the process of refactoring some InfoPath 2010 forms for wider reuse. One of the views in the form was an “instructions” page, but rather than having all this “static” formatted text live on the form I wanted it to pull it from a SharePoint list that could then be easily edited and maintained by business users without having to modify the form.
This sounds reasonably easy, and I even already had a data source connection to the list I wanted to use, so all I had to do was add a new field to the SharePoint list as a Multi-Line Text datatype with rich text enabled. I didn’t want these instructions to load/change every time the form was opened, so my strategy was to create a rule and based on a condition (that told me the form was a new one) I would query the secondary data source and pull the rich text from SharePoint and store it in field located in my Main data source. I made sure that this new field was of the datatype “Rich Text (XHTML)” and that the actual Rich Text box control placed on the form was set to “Enable enhanced rich text…”, etc… Problem was that when I previewed the form, the text from the SharePoint list showed up, but all the formatting was stripped.
After a bit of troubleshooting I determined that the RTF formatting was indeed coming over from the SharePoint List data source, in fact if I bound a repeating table with a RTB directly to the secondary data source field it did indeed show the text formatted. Most other sources on the internet pointed at a faulty implementation of the “Set a Field’s Value…” rule action. Since in my case this is a pretty complex form and I had a code-behind (sandbox solution) I had the luxury of digging into this a bit further. What I found is that the problem is not with the Rule Action implementation because the formatting is not lost upon the call to .SetValue() (on the XPathNavigator pointing at your target field). It is actually lost when you read the value out of the .Value property (of the XPathNavigator pointing at your source field).
So I came up with a work around that appears to be working. That is instead of reading and writing these field values, if you pull the entire .InnerXML property of the source and set the target’s .InnerXML property to it, all the formatting properly comes over! Here’s a helper function that illustrates what I’m talking about:
private void CopyFieldValueByXml(DataSource sourceDatasource, string sourceXPath,
DataSource targetDatasource, string targetXPath)
XPathNavigator sourceNav = sourceDatasource.CreateNavigator();
XPathNavigator sourceField = sourceNav.SelectSingleNode(sourceXPath, NamespaceManager);
string dataXml = sourceField.InnerXml;
XPathNavigator targetNav = targetDatasource.CreateNavigator();
XPathNavigator targetField = targetNav.SelectSingleNode(targetXPath, NamespaceManager);
targetField.InnerXml = dataXml;
So now some warnings: First off, I (or you) still need to do a bit more testing on this work around because in my simple use case I only needed to pull static rich text into my document. I don’t know for sure if there will be any ill effects should we need to later go and edit this rich text within the form. Second, and more importantly, this little work around will only work if you are using a code behind (doesn’t have to be an admin form, I’m doing this with a sandbox solution). If this is the ONLY reason you are using a code behind then that’s probably a very unnecessary maintenance burden you are placing on your solution for a very small gain. I would not recommend you do this in that scenario. However, if you are in a situation like mine, where you need the code behind anyway, then have at it!
July 1, 2011 - 11:00, by Dostalek, Kevin
I recently began using a service called greplin which has changed the way I search for things in all my “life streams”. Since I did a few optimizations I wanted to give a quite review of the service and then also share with all my readers some tips that I think can make it work even better.
Before I get into greplin, use this link to access it: https://www.greplin.com/r/c/738522
That is somewhat of an “affiliate link”, though NO money is involved. It’s just my personal “refer a friend” link which earns both YOU and me “unlock credits” (as opposed to if you just go to http://greplin.com).
What is It?
Ok, so greplin basically lets you attach various data sources such as Twitter, Facebook, LinkedIN, Dropbox, Gmail, Evernote, etc… and it builds a personal index of all of them for you (that only you can access of course). Then whenever you want to find something, you just search from their page (which pretty much looks like a blue version of google) and you get all of your results grouped by (and filterable by) result type (people, messages, streams, files, etc…) as well as data source. It has all the cool AJAXy enhancements too like immediate results as you type and result refiners (facets) to narrow your results.
When you get started, you just add in your data sources and it starts the indexing process. It seemed like wherever it was possible they used oAuth (or a variant, like Facebook connect), so they wouldn’t actually be storing your username/password, though I think there were a few where it might have. All my data sources were a snap to set up, though when I first added my Gmail account it seemed to hang up on indexing. I later figured out that this was just because I use my Gmail account to send canary emails to myself at my home-based email server every 5 minutes, and Gmail had stored all of these “sent items” – about 150k of them (ha!). After I deleted all of those (which only took about 2 minutes in Gmail) things were much better. I’m presently indexing Facebook, Twitter, Dropbox, LinkedIN, and 2 Gmail accounts. It says it’s currently indexing 20336 documents for me (always changing of course).
Though I’m only using the “free” index data sources, they also have available other sources that are “unlockable” which you get for free once you invite enough people and earn “unlock credits”. Then there are “premium” data sources such as Google Apps, 37Signals Apps, Salesforce, Yammer, and Evernote that you need a paid account for (at the time of this writing it is $5/mo or $50/yr). That’s too bad about Evernote, because I do use it heavily, but I don’t know if I can justify $5/mo to search it when I can search it for free elsewhere.
A Few Tips
If you use Google Chrome as your browser, install the greplin extension. Not only does it add a little icon that lets you do quick searches, but it adds a shortcut in your address bar so that if you type g[space] (that is the g key followed by the spacebar) you can type your greplin search right in the address bar. For those of you that don’t know it, you can do the same thing for a google search by typing g[tab].
If you have multiple Gmail accounts this is the perfect solution for being able to search across them. After you add in your first Gmail data source just make sure you log out of Gmail completely in your browser so that when you go back to add the second (and third, etc…) it prompts you for another login instead of just connecting you to the one you’ve already added. Also make sure that your Gmail accounts have IMAP enabled, but that you aren’t using the quirky “Advanced IMAP Controls” Lab mode.
If you want to use this on your mobile device, they have done a pretty good job with autodetecting and redirecting a mobile version of the search/results page which is very nice. If you use an iPhone, while there is no App (yet), you can make your own by doing the following:
- Navigate to greplin.com – it will open in mobile mode.
- Scroll to the bottom and click the link to switch to standard view
- Pinch zoom all the way into the upper left corner so that all you see on the screen is the greplin logo (the cloud) centered or slightly below centered.
- Click the share button (bottom center) then choose “Add to Home Screen”
- Close browser. You should now see an app with the greplin logo on the Springboard. Click it (touch it?) greplin should open up in mobile mode again. If for some reason it isn’t, just scroll to the bottom and choose mobile version. It should stay in that mode from there forward.
Now you have a quick way of accessing your personal search engine from your iPhone! How cool is that?
May 24, 2011 - 21:10, by Dostalek, Kevin
Some of you may be familiar with a feature named ViewFormPagesLockdown that ships with MOSS 2007 and SharePoint Server 2010. It’s automatically enabled when you create a new site using the publishing template. Basically, if you enable anonymous access then this feature will keep those anonymous users out of application pages and form pages while still allowing them read access to the underlying list/document data. So for example, they can open a publishing page in a Pages library or download a document from a document library, but they are not able to access the page item property view form or view a list of all the documents in the library.
This feature wasn’t present in WSS, but that makes sense since WSS doesn’t support the publishing infrastructure anyway. However, now that we have Wiki Page libraries (/SitePages) available in SharePoint 2010 Foundation (SPF from here on) you very well might want to have that same behavior to lock out anonymous users from the “backstage” of a public facing web site.
Take a look at the screenshot below that was taken from the SharePoint Management Shell running on a SharePoint 2010 Server:
It’s a hidden feature, but no problem on Server; you can simply activate this feature from PowerShell. However, if you run the same command on an SPF server you will get NADA. It’s not installed. What to do?
Well, it turns out that all that this feature does is change a few of the permissions for the Limited Access Role in the site collection. There’s not an easy way to get at that via the web UI, but it’s almost trivial with a tiny bit of code. Here’s a very truncated version of what you need to do:
1: string url="http://yoursite";
2: using(var site = new SPSite(url))
4: SPWeb rootWeb = site.RootWeb;
5: SPRoleDefinition guestRole = rootWeb.RoleDefinitions.GetByType(SPRoleType.Guest);
6: guestRole.BasePermissions &= ~(SPBasePermissions.EmptyMask | SPBasePermissions.ViewFormPages);
7: guestRole.BasePermissions &= ~SPBasePermissions.UseRemoteAPIs;
8: rootWeb.AnonymousPermMask64 &= ~(SPBasePermissions.UseRemoteAPIs | SPBasePermissions.ViewFormPages);
For those that would like something a bit more polished, say a well behaved command line application or an actual SharePoint feature you can turn on and off, contact me and I’ll hook you up.
May 9, 2011 - 23:00, by Dostalek, Kevin
Hey all! I've been needing to do some work on the blog here for awhile, and since it looks like I'm about to get very busy starting tomorrow I figured I better try and sneak it in tonight!
I've had to chnage out the comment engine again. This time to the new Facebook comment plugin. I know this may be an unpopular move and I *really* liked Echo (the last comment engine we had), but the price had jumped from $12 a year to $120, and I couldn't relly justify that since I only had about 100 comments last year anyway. I will miss the cool way it pulled in stuff from Twitter and Friendfeed automatically, but it seemed like the best discussions were either directly "on the site" (no social networks) or Facebook.
So anyway, try out the new comments widgets... it's just like facebook. Cool thing is if you allow it to post through to facebook as well, then any comments your friends make on the post will also show up here on the blog (don't worry, it makes it clear whats happening when they reply).
Unfortunately, this also means that every post on The Kickboard now has 0 comments. That kind of hurts, but since I've been so bad at posting over the last 6 months or so anyway, it doesn't hurt nearly as much as it might. Please let me know if you notice something not working right!