SPServiceContext or SPContext in SharePoint 2010

26 October 2009 Toby Leave a comment

After attending the SharePoint Conference 2009, I’m just trying to get clarification on the use of SPServiceContext and SPContext.

In a couple of the developer sessions, the speakers suggested we should use SPServiceContext now instead of SPContext.

Is there an instance where we should use one over the other or should it now always be SPServiceContext?

Any feedback would be greatly appreciated.

SharePoint Conference 2009 – Day Two

22 October 2009 Toby Leave a comment

I’ve now managed to get my head around most of the new and enhanced features of SharePoint 2010.

My main focus has been around enterprise search and social computing. Two areas I believe are going to massive, when SharePoint 2010 gets released.

I managed to attend the following sessions;

  • SharePoint 2010 Search: Capabilities Deep Dive
  • Adoption Strategies for Social Computing
  • Microsoft Unified Communications and Collaboration in Action
  • Deep Dive into SharePoint 2010 My Sites and Social Networking Architecture
  • Search Relevance and Relevance tuning

There has been a large investment in the new and enhanced features. My Sites have become the hub for interacting with people through My Sites, User Profiles, Status Updates, Activity Feeds and Knowledge Mining.

SharePoint Conference 2009 – Day One

20 October 2009 Toby Leave a comment

Well I made it. After travelling for about 12 hours from London to San Fransico to Las Vegas and managed to get over the jet lag (nothing to do with Vegas!)

Today was about getting to know the new version of SharePoint 2010.

We were given an introduction to the product by Steve Ballmer (Microsoft CEO) and Jeff Tepper (Corporate Vice President). There were some nice little sneak peaks and I was surprised that the first demo was a code demo!

My first break session was the “SharePoint 2010 Overview and What’s New” and this gave me a good overview of all the exciting new features available in SharePoint 2010.

Here is a break down (In no particular order) of some of the most exciting

  • PowerPivot (Project ‘Gemini’)
  • Taxonomy management including tagging and ratings,
  • Business Connectivity Services and External Content Types
  • Visual Studio 2010 Tools for SharePoint
  • Excel, Access and Visio Services and the Office Web Apps
  • Sandboxed Solutions

There is a shed load of more features and I’ll blog on them, when I know more.

I then made it along to the ‘Introduction to SharePoint Designer 2010′ and ‘Overview of Social Computing in SharePoint 2010′. The Social Computing of SharePoint 2010 has been greatly improved and their definitely seems to be a nod to Facebook there (The status update and note board).

IMG_0189.JPG IMG_0188.JPG

Pictures from the SharePoint Conference 2009

19 October 2009 Toby Leave a comment

Some pictures from the conference so far

SharePoint Conference 2009

23 September 2009 Toby Leave a comment

Just received confirmation that I’ll be attending the SharePoint Conference 2009 in Las Vegas.

I’m really looking forward to this event and can’t wait to see all the new features of SharePoint 2010.

See you there!

SharePoint Conference 2009

My Productivity Toolset

13 September 2009 Toby Leave a comment

I use a range of devices in a number of different locations and have always found it difficult to find the products to help manage my various sources of content.

My problem is that at home I’m a Mac man, at work I’m a PC man and out and about I pray at the altar of the iPhone.

I like products that focus on a particular job and do it well, I have yet to find a product that covers them all (though here’s waiting for SharePoint 2010 Server ;-) ). I need these products to be able to easily switch between work and home and back again (that’s why SharePoint is not in the equation).

And my last crtieria? It has to have a good old desktop client version. As much as I love “the cloud”, in my world the “the cloud” is were my data lives and not were I do my work.

These are the core areas I need to manage in my life and the products I’ve found best at doing that. Please feel free to add your favorites.

Email / Contacts / Calendar



Thanks to companies now supplying low cost Exchange accounts through hosted solutions, this is a viable way of managing email, contacts and calendar through all devices and locations.

You need to make sure the companies includes Outlook Anywhere / Exchange Web Services and OWA, this will then tick all the boxes. I can access it through Outlook client on my PC, using the Exchange Integration in OSX Snow Leopard and through my iPhone with Exchange Integration. And when I don’t have access to any of this I can access it through OWA.

Task Management



I sort of adopt to the GTD method of managing tasks, I like the idea of having projects and contexts when managing tasks and I like to store all my tasks together from both work and home.

EasyTask Manager seems to tick all the boxes again. It provides a client for both the Mac, PC and iPhone and has a web interface. Some of the clients are not perfect, but they seem to be ironing out all the problems quickly.

Scrapbook



I like to use a scrapbook to pull together all my notes, links and other odds and sods. I had previously used OneNote for this, but it tied all my information down to my PC.

Evernote is my tool of choice now. It provides a client for the Mac, PC, iPhone and web (It also has a Windows Mobile client). It has browser and email addins that allow you to take snapshots of sites or emails (very useful for storing links to sites if the site then disappear).

News Feeds



Using a combination of NetNewsWire for the Mac / iPhone and FeedDemon on the PC and Google Reader to sync, I’m able to keep up-to-date with all my favourite feeds, flag ones that I may need to reference again. This is then all kept synced up between all my devices by Google Reader.

Blogs / Twitter

ecto_128px.png



I like to use Ecto for the Mac, Windows Live Writer (I wish they did a Mac version) and WordPress for the iPhone as my blog is hosted through WordPress.

For Twitter I’m not really into the over complicated tools like TweetDeck and prefer to stick the simple client like Tweetie which I use on the Mac and the iPhone.

Document Management


images-5.jpeg

Mesh is my tool of choice for managing my documents and making them available to all my devices. It doesn’t currently support the iPhone, but rumor has it that it’s not too far off.


Categories: Uncategorized Tags:

Balsamiq Mockups for Desktop

8 July 2009 Toby 1 comment

This is a great tool for mock-ups, especially when designing MOSS sites. I’ve been using it for a dashboard solution and has been great for reviewing with the client without getting too bogged down in the technology.

MySite

Somebody has even developed a whole bunch of MOSS components to get you on your way.

MOSS

Have a look here for more information

www.balsamiq.com

Categories: Design

Beware of deleting Global Navigation nodes in SPWeb.Navigation.GlobalNodes

9 April 2008 Toby 2 comments

For a standard team site (STS#0) the GlobalNodes SPNavigationNodesCollection will contain three SPNavigationNode objects.

Home, Quick Launch and SharePoint Top Navigation Bar, these each have Ids of 1000, 1002 and 1025 respectively.

The problem occurs if you delete Quick Launch or SharePoint Top Navigation nodes. Even if you then add them back in a new ID is generated and SPWeb.Navigation.TopNavigationBar looks for child nodes under a node with an Id of 1002 (This is hard coded).

Through the API this means that SPWeb.Navigation.TopNavigationBar will always be null and through the SharePoint UI an error will be returned to the user (“Value does not exist in that range”).

The only ways I have found to fix this is to delete and re-create the site or (Microsoft please close your ears) get the site id and web id and query the NavNodes table in the content database the site collection sits in and add the following records

SiteId
WebId
Eid
EidParent
NumChildren
RankChild
ElementType
Url
DocId
Name
DateLastModified
NodeMetaInfo
NonNavPage
NavSequence
ChildOfSequence
C803FD13-27FA-475F-909C-2CE5B2048E1B
A31E8093-1505-4E1C-B7CC-04D6B952A33F
1000
0
0
0
0
NULL
A31414EE-953B-44CC-A37E-4D5D643B002A
Home
2008-04-04 11:28:21.000
NULL
False
False
False
C803FD13-27FA-475F-909C-2CE5B2048E1B
A31E8093-1505-4E1C-B7CC-04D6B952A33F
1002
0
0
2
1
 
NULL
SharePoint Top Navigation
2008-04-04 11:28:21.000
NULL
False
True
False
C803FD13-27FA-475F-909C-2CE5B2048E1B
A31E8093-1505-4E1C-B7CC-04D6B952A33F
1025
0
0
1
1
 
NULL
Quick Launch
2008-04-04 11:28:21.000
NULL
True
True
False
Categories: Navigation Tags:

Invalid object name ‘Groups’ when using PSCONFIG

1 March 2008 Toby 1 comment

I have been trying to rebuild a development environment recently using DBA created tables.

Every time I ran the PSCONFIG -cmd configdb -create command it ran and then threw an  error.

The error message above was logged.

After looking through the tables, I noticed that some of the tables in both the config db and the config admin db had been created under the user account I had been running the installation under and some had been created under dbo.

There are a couple of SQL scripts in the layouts folder under SQL that are run to create the schemas and here I think is the problem.

Most of the CREATE TABLE statements using the following syntax CREATE TABLE [dbo].[TableName], but there are a few tables in both databases that just use CREATE TABLE TableName.

The error occurs because further SQL script is then referencing [dbo].[TableName], but these tables don’t exist under the dbo user schema, so it errors.

The solution is to change the SQL scripts so all CREATE TABLE statements have [dbo]. infront of them. Before you run it again you will need to clear out all the objects from both the databases.

We have some rather quirky database rights in our environment, but the install account and the farm service account both had dbcreator and secuirtyadmin rights and were in the db_owner role for each of the databases. 

Categories: Uncategorized

Matching the ScopeId from SPAuditEntry.EventData to SPListItem

6 February 2008 Toby 4 comments

To match the ScopeId in the EventData property of the SPAuditEntry to a SPListItem you need to use the hidden column ‘ScopeId’ and not the Id property of SPListItem.

Here is what I mean

The following XML is returned in the EventData proprty for a SPAuditEventType of SecRoleBindUpdate. To match the Scope returned in the XML to SPSite, SPWeb and SPList object you would use the Id property of this object, but not for the SPListItem.

<roleid>1073741826</roleid>
<principalid>11</principalid>
<scope>72EEC412-B14B-4EFB-AB95-EA821A3A4C63</scope>

You need to use the ‘ScopeId’ column of the SPListItem

So why can’t I just use the SPAuditQuery.RestrictToListItem method to return the audit entries for that SPListItem.

It doesn’t work, that’s why and this has been confirmed by MS Support.

Here is a workaround that will link the ScopeId to the SPListItem that triggered the audit entry


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace ConsoleApplication1
{
  class Program
  {
  static void Main(string[] args)
  {

string siteUrl = "http://url";
  string listName = "TheList";
  string scopeIdFromItem = string.Empty;
  string scopeIdFromChange = string.Empty;

try
  {
  using (SPSite site = new SPSite(siteUrl))
  {
  using (SPWeb web = site.OpenWeb())
  {

SPList list = web.Lists[listName];

SPRegionalSettings regionalSettings = web.RegionalSettings;
  SPTimeZone timeZone = regionalSettings.TimeZone;

SPAuditQuery query = new SPAuditQuery(site);
  SPAuditEntryCollection auditEntries = site.Audit.GetEntries(query);

foreach (SPAuditEntry auditEntry in auditEntries)
  {
  if (IsSecurityEvent(auditEntry))
  {
  try
  {
  if (auditEntry.Event.ToString().ToUpper() == "SECROLEBINDUPDATE")
  {

// Should really do a proper XML query here, but for demo just do some string stuff
  scopeIdFromChange = auditEntry.EventData.ToString().Substring((auditEntry.EventData.ToString().Length - 44), 36);

foreach (SPListItem item in list.Items)
  {

// Square brackets round the scope id need to be removed
  scopeIdFromItem = item["ScopeId"].ToString().Substring(1, 36);

if (scopeIdFromChange == scopeIdFromItem)
  {
  Console.Write("Event Data : "); Console.WriteLine(auditEntry.EventData.ToString());
  Console.Write("Occurred : "); Console.WriteLine(timeZone.UTCToLocalTime(auditEntry.Occurred));

if (list.BaseType == SPBaseType.DocumentLibrary)
  {
  Console.WriteLine("Security changed on file: " + item.File.ToString());
  }
  if (list.BaseType == SPBaseType.GenericList)
  {
  Console.WriteLine("Security changed on item: " + item.Name.ToString());
  }
  }
  else
  {
  Console.WriteLine("No item found in list " + siteUrl + "/" + listName + " for " + auditEntry.EventData.ToString());
  }
  }
  }
  }
  catch (Exception ex)
  {
  Console.WriteLine(ex.Message.ToString());
  }

}
  }
  }
  }
  }
  catch (Exception ex)
  {
  Console.WriteLine(ex.Message);
  }
  }

private static bool IsSecurityEvent(SPAuditEntry entryToTest)
  {
  SPAuditEventType[] SECURITY_EVENTS = new SPAuditEventType[]
  {
  SPAuditEventType.SecGroupCreate,
  SPAuditEventType.SecGroupDelete,
  SPAuditEventType.SecGroupMemberAdd,
  SPAuditEventType.SecGroupMemberDel,
  SPAuditEventType.SecRoleBindBreakInherit,
  SPAuditEventType.SecRoleBindInherit,
  SPAuditEventType.SecRoleBindUpdate,
  SPAuditEventType.SecRoleDefBreakInherit,
  SPAuditEventType.SecRoleDefCreate,
  SPAuditEventType.SecRoleDefDelete,
  SPAuditEventType.SecRoleDefModify
  };

foreach (SPAuditEventType eventType in SECURITY_EVENTS)
  {
  if (eventType == entryToTest.Event) return true;
  }

return false;

}

}

}

Categories: Auditing, Bugs