SharePoint Theme Settings page and Enhanced Theming

If you create a site using the Blank template and go to Settings > Site Theme you get a simple page that lets you set your site theme.

If you create a site using the Team Site template and go to Settings > Site Theme, you get a more advanced page.

Both these experiences are supported by the one page (/_layouts/themeweb.aspx). So what gives? Continue reading

“To save to the server, correct the invalid or missing required properties”

I’ve been working on a custom field for, well, a while now, and after making some changes I started to get the error “To save to the server, correct the invalid or missing required properties” when trying to edit a document and save the changes back in Word 2007. This was a little strange, as I’d already sorted out hiding the custom field from the document information panel, and things had been working fine since then.

New documents seemed to be alright, but the older ones weren’t. So, maybe the problems were all the old documents, rather than my field.

Eventually, I came across this knowledgebase article – so I “inspected” the document, removed any of it’s custom data, and resaved it – and it worked fine.

What I think happened here was, I was testing different settings for Content Approval and Versioning on my document libraries. I think the troublesome documents were created when one of those was set to be ‘on’, and I subsequently turned it ‘off’. This meant that the document actually had extra data that referred to a column that no longer existed (I think) – which probably means this is related to Content Approval.

But I’d be curious if anyone else has managed to cause this error, and how they did so.

Observations on SharePoint 2007′s irritating Audit

Auditing with SharePoint 2007 is something that I’ve managed to avoid playing with until our current project. Frankly, this has mainly been because the user interface for audit details is inadequate out of the box. Most other systems, you just go to a page, and see what happened to that item.

Anyway now that I’ve started to take a look at it in more detail, I notice a few other minor problems with it… Continue reading

Installing SharePoint on a K2 Server

Okay, so I’ve not been blogging much recently as I have been sidetracked onto exciting deployment tests for the system we’ve been working on. However, I did come across this interesting issue…

Normally, if I were having K2 BlackPearl on the same box as SharePoint, I would install SharePoint first, then K2. This seems to work without much fuss, and is the right way of doing it.

However, this time I had installed K2, and was now trying to install SharePoint (long story). However, SharePoint’s installer kept failing (using the SP2 with cumumlative updates to April, in a slipstream installer). It simply would not complete successfully.

Eventually, we tracked this down to the SQL 2005 Report Viewer. We uninstalled (via ‘Add an Remove Progams’) the ‘Microsoft Report Viewer Redistributable 2005′ program, stopped the K2 BlackPearl service, and tried installing SharePoint again. It worked.

Of course, the idea would be, don’t have the two on the same box. But just in case someone else tries the same thing.

And I hope I’ll get back to development soon.

How I simplified the Users and Group UI – Conclusion

So, I thought a little wrap up of what we’ve seen and how I figured all this out. Much of what we’ve looked it is just a simplified version of the standard ‘People and Groups’ pages, and a lot of digging around with reflector was involved!

We’ve seen:

  • That listing users is fairly simple using some ‘magic values’, but that supporting the ‘View Selector’ is a bit more complex!
  • That resolving the MembershipGroupId GET parameter is important, but pretty simple, and that there are many ways you could choose to do this.
  • That adding users is pretty simple too – it’s just the sort of SharePoint API code you’d get asked about in the WSS3 App Dev exam.
  • That removing users is a bit yucky – JavaScript to get the IDs of selected users – but again, the code itself is pretty straightforward.

Now the moment you’ve been waiting for – the code for the 3 pages we’ve used itself. Note that I’ve also used a custom Master page for my sites – you’ll want to build your own, with your own navigation, etc..

  • Introduction
  • How to Display a list of users
  • How to Find the MembershipGroupId
  • How to Add Users
  • How to Remove Users
  • Conclusion
  • How I simplified the Users and Group UI – Removing Users

    The final component in my users and groups UI is the ability to remove users. This is based very much on how SharePoint works – and it’s a little ugly. My apologies -but this is how SharePoint does it.

    Our ListView shows our users. Each user has a checkbox next to them:

    ListView

    I’ve added a ‘Remove Users’ LinkButton to my fake ‘toolbar’:

    Title and View Controls

    That LinkButton is defined in my page as:

    <asp:LinkButton UseSubmitBehavior="false" id="BtnRemoveUsersFromGroup" runat="server"
    Text="Remove Users"
    OnClick="BtnRemoveUsersFromGroup_Click"
    OnClientClick="return BtnRemoveUsersClick();"
    />

    So, on click it runs some client script, and then posts back a click event. So, how do you know which users have been selected within the postback? You could have zero-to-N checkboxes! Continue reading

    How I simplified the Users and Group UI – Adding Users

    So, in the previous posts we’ve looked at how to resolve a MembershipGroupId for a group (or at least, one way of doing so), and how to list users. Now, how do we add new users to our group?

    Well, on our ‘list of users’ page, I have what looks like a a SharePoint toolbar. It’s actually just a table cunningly formatted to look like a toolbar, and the ‘Add users’ link on it is a LinkButton. In the codebehind it’s click event is:

    protected void BtnAddUsersToGroup_Click(object sender, EventArgs e)
    {
    int iGroup = (int)ViewState[GROUP];
    SPUtility.Redirect("SimpleUG/AddUsers.aspx?MembershipGroupId=" + iGroup, SPRedirectFlags.RelativeToLayoutsPage, this.Context);
    }

    So, all we’re doing is going to a page called ‘AddUsers’ and passing the MembershipGroupId again. Continue reading

    How I simplified the Users and Group UI – Resolve the MembershipGroupID

    So, one of the things I skipped over in my last post was just how you get the MembershipGroupID for the group you want the users to administer. Well, there are lots of options – all you’ve got to do is get to your page with the ListView with the correct value for the GET parameter MembershipGroupId.

    If you knew the ID in advance, you could hard code it. I didn’t, so I used a redirect page. Continue reading

    How I simplified the Users and Group UI – Listing Users

    Listing users in my page was actually the easiest bit of the whole solution. In the ASP of my page, I added:

    <SharePoint:ListView id="UserListView" ListID="UserInfo" runat="server"/>

    And my page showed:

    ListView

    This is a SharePoint ListView, and the id and ListID appear to be ‘magic’ values. If set as above, the web part will display the users in the group specified by the MembershipGroupId GET parameter for the page. Try it – go to the normal users and groups pages, to to view the members of a group, and try replacing the integer ID of the group. (Not all are used)

    So, that bit of magic shows me the list of users. In my page’s OnLoad event I also read the MembershipGroupId parameter and used that to read the name of the group we’re editting, which I then used in the PageTitle area. We’ll see this later.

    Title and View Controls

    (My Site is called ‘Blank’ and we’re editing the ‘Blank Members’ group)

    That’s all I needed really, but as a bonus I’m also going to describe how I added the View Control. Continue reading