So this is a bit of a rugged solution but its just nice to have SOME validation on a people picker within a JQuery dialog before that sucker disappears (when a user clicks OK). Below is an example dialog declaration and the click event over-ride function to validate the people picker (Check Names link). Unfortunately it does require the ‘Are you sure’ pop up, just so we can give the people picker elements enough time to change based on the built in ‘check names validation’. If we don’t have this pause then the validation is done before the Click event has completed and updated the relevant elements. I’m sure you could use some wait function instead if you like. As you can see, the people picker control gets broken down in to quite the html nightmare- you should view the source of a page with one just for kicks.
January 25, 2010
January 25, 2010
Filtering a List by SPD Workflow Status Column
Posted by mossipqueen under SharePoint, SharePoint Designer, Worklfow | Tags: Views |Leave a Comment
I can’t believe I hadn’t attempted to do this earlier but last week I was setting up a sort of dashboard page for a SharePoint audit site and I found I wanted to display a list of the site’s In Progress workflows. I had set up a simple SPD workflow on a list, which acted as the source and storage for the workflow forms, so consequently it had the Workflow Name column to display the status. When I created an “In Progress” view on the list web part, I got a strange Render Error. It became clear that I could not filter the list where the Workflow Name column value = In Progress. So after some digging around I discovered that the SPD workflow statuses are actually represented by numerical values not text, so here are the mappings:
2: In Progress
5: Complete
15: Cancelled
So get filtering
January 12, 2010
Migrating Outlook Calendars to SharePoint
Posted by mossipqueen under Calendar List, SharePoint, UncategorizedLeave a Comment
I recently had a client that wanted their Staff Movements calendar moved to the SharePoint intranet. They wanted the migration to be seamless so the secretaries and admins that updated the Calendar basically had no idea anything had changed. These users were accessing and updating the Calendar by adding it as a Shared Calendar in Outlook 2003. Now MS likes to talk about how easy it is to” Synchronise” SharePoint Calendars with Outlook (Calendar List-> Actions -> Connect to Outlook) which is handy but it’s a one way street. What do MS say when you want to take an Outlook Calendar, complete with months and months of existing event data, and plop it into SharePoint then? .. “Chirp Chirp Chirp”
In the hope that I can make some useful noise of the subject, I have listed instructions for both Outlook 2007 and 2003:
Outlook 2007 – what are ya? Scared?
- Open the Outlook Calendar in Outlook 2007
- Create a SharePoint Calendar list
- On the list, click Actions- > Connect to Outlook. Accept all connection/trust prompts. Now you can see the SharePoint Calendar in Outlook along side the source calendar.
- In Outloook, on the main menu select View -> Current View -> All Appointments

- Press Ctrl A to highligh all entries and then Ctrl C to copy them
- Click the check box next to the SharePoint Calendar you have just added to Outlook
- On the main menu select View -> Current View -> All Appointments
- Paste the copied entries from the source calendar into the SharePoint calendar
- Click Ok, then in SharePoint, refresh your Calendar list and you will see the new entries.
Outlook 2003 – now you’re talkin
- Open the Outlook Calendar in Outlook 2003
- Click on the Calendar so it is in focus (if in public folder, click Calendar folder). You can also select File-> Open -> Other User’s Folder to open a Calendar to locate the relevant Outlook Calendar.
- Export the Calendar to a CSV file by selecting File -> Import and Export
- Open the csv file in Excel. You will notice that the Start Date and Start Time are two separate columns. Combine these values into one column and repeat for End Date and End Time. Its up to you how you do this, you may use Excel functions or reg expressions, what ever tickles your fancy.
- Create a SharePoint Calendar list
- Select the All Events view and then select Actions-> Edit in Datasheet
- Select each column and paste the CSV column into the relevant SharePoint list column.
- When all columns are in, Select Actions -> Show in Standard and chose the calendar view. You should now have all you events ready to roll.
Now copying and pasting is kinda the dirty way of doing it, you could also export to a xsl file and look at data connections and synch-ing with the SharePoint list but at the end of the day, if you don’t have many fields to populate, why not just whack it in yourself. One issue I did come across here was the All day Event flag. When Pasting in that column, it seems to be all or nothing and all values were set to True which in my case was fine because this was the case in the source Calendar anyway bar a few measily events.
January 12, 2010
Getting SPListItems from a multi-value Lookup Column
Posted by mossipqueen under Lookup Column, SharePoint | Tags: SharePoint |Leave a Comment
I have put this example together because I wanted to demo how to get multiple SPListItems from a lookup column rather than just the one OR just the lookup value/text. Anyway, it’s a handy piece of code to have on hand because lookup columns are always a little tricky to deal with but they are also super useful. For example, I used the code below in a web part that filters displayed list items based on a complex filter defined in another list. So rather than having one column which defined a filter i.e. ‘User=Me’ I had a whole list of columns which each defined a specific filter: type, condition for applictaion, property and value.
public bool displayItem(SPListItem listItem)
{
bool displayItem = true;
try
{
if (!String.IsNullOrEmpty(listItem["PreferenceFilter"].ToString()))
{
if (listItem.Fields["PreferenceFilter"] is SPFieldLookup)
{
SPFieldLookup lookupField = (SPFieldLookup)listItem.Fields["PreferenceFilter"];
Guid webID = lookupField.LookupWebId;
Guid listID = new Guid(lookupField.LookupList);
string[] splitStr = { “;”, “#” };// 2;#Filter1;#3;#Filter2
splitStr = listItem["PreferenceFilter"].ToString().Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < splitStr.Length; i = i + 2)
{
int itemID = Int32.Parse(splitStr[i]);
SPListItem lookupItem = SPContext.Current.Site.OpenWeb(webID).Lists[listID].GetItemById(itemID);
string filterType = lookupItem["FilterType"].ToString();
string propName = lookupItem["PropertyTitle"].ToString();
string propValue = lookupItem["PropertyValue"].ToString();
if (FilterType… && PropertyTitle….)
{
displayItem = false;
}
etc
December 22, 2009
Can’t Set PeopleEditor.CommaSeparatedAccounts
Posted by mossipqueen under UncategorizedLeave a Comment
This is quirky but I believe I have figured it out: The other day I was trying to set a PeopleEditor’s CommaSeparatedAccounts attribute but it would not take my string. I debugged the code and actually witnessed with my own eyes the assignment of the new user string but then when I checked the attribute value it was still String.Empty(“”). So I had a hunch, tried this and it finally it took my username string and it darn well liked it:
bool isVisible = peUser.Visible;
peUser.Visible = true;
peUser.CommaSeparatedAccounts = ddlUserMatrixSelector.SelectedValue;
peApprover.Visible = isVisible;
The moral of the story is control.visible must be true to set this attribute.
September 17, 2009
The evaluation version of Microsoft Office Sharepoint Server 2007 for this server is expired
Posted by mossipqueen under Errors, SharePoint | Tags: SSP |Leave a Comment
I was getting this error when trying to access my SSP. Then I found this terrific forum thread that made my day. Thanks Lionel!
To summarise:
September 17, 2009
Create a new Site Collection in a new Content DB
Posted by mossipqueen under UncategorizedLeave a Comment
This is more a reminder for myself since I am ALWAYS forgetting this command. Run this on the SharePoint server under the farm account to ensure you don’t have any restricted access issues.
stsadm -o createsiteinnewdb -url http://server/sites/collection -owneremail you@sharepointadmin.com -ownerlogin testss\SPAdmin -sitetemplate sts -title “Site Collection” -databaseserver SERVERDB -databasename NewContentDB
September 16, 2009
Displaying all Document Libraries Within a Site
Posted by mossipqueen under SharePoint, Web Part | Tags: BaseType |Leave a Comment
Quick and easy- navigate to http://server/yoursite/_layouts/viewlsts.aspx?BaseType=1 There you will get a “list” of document libraries in the current site. You will notice on the RHS you have the standard list VIEW menu. You can change this to see Picture libraries, lists, etc OR you can just change the BaseType value in the URL yourself. This ain’t real pretty and it doesn’t come wrapped up in a nice lil web part package but its not that hard to create one. I am not going to bother since I found this fabuMOSS (‘oh yes I did’) CodePlex creation which don’t just list em but allows you to explore em using a treeview menu. Shazam!
May 18, 2009
Installing and customising a test environment based on a production SharePoint environment
Posted by mossipqueen under Configuration, Install, SharePoint, SharePoint Designer | Tags: SharePoint |Leave a Comment
When clients request a test environment as an “after thought” to installing and configuring a production environment you’ve got to make a few decisions about how this will be done. This post will outline how I prefer to swing it and what has worked for me so far. Keep in mind though that farm size and capacity should dictate your methods. The methods I discuss here fit for a small to medium size farm.
Virtualisation
Where possible recommend setting up virtual servers to replicate the production environment. This is usually a lot cheaper and allows for a lot more flexibility. You quite often see businesses using a test environment which is a single server setup despite their production farms containing multiple servers. It is always best to try to mimic the environment completely and with virtual servers this is a bit easier as you can magically conjure a swish new server from virtually nothing
Snapshot or fresh install
Fresh install definitely, although I can’t say I’ve ever tried the alternative. If the prod environment happens to be virtual too I wouldn’t recommend taking a snapshot and restoring it as a test environment. I can imagine all kinds of conflicts and issues with that and you reeeeally don’t want to jeopardize your production environment. I prefer to start from scratch and install the pre-requisites, SharePoint, services packs and updates again.
Database Servers- to share or not to share
I usually recommend sharing (remember I am talking about small to medium farms here) but that’s usually because it’s the more preferred, cheaper option. If you already have a spare SQL server sitting around, you can certainly take advantage of that. I do find it a bit of an advantage sharing with production though when it comes to troubleshooting issues. Remember we really want prod and test to be identical. When an error is occurring on the prod environment and it is also occurring on the test server you can pretty much assume the issue is occurring in a shared resource which narrows down the search somewhat. I always recommend creating a separate SQL instance for test though. That way you can keep you DB naming convention the same and it’s not confusing when trying to figure out which DBs are for prod and which are for test.
Back-end Configuration
Set your SSP and services up as you did in production although it doesn’t really matter if this is exactly the same. For example the user profile import probably doesn’t need to run quite as regularly as it does in production but then again I have been pushing the identical environment thing so you may just want to make the effort and set them up with exactly the same schedules. If you have created an “as built/installed” document previously with all this configuration detail, now is a great time to test is accuracy.
Content Database Migration
Now as you have installed SharePoint in the exact same way as in production (with all the latest updates and service packs) you can relax and know that you can add your production content databases to the test farm no problems at all. What I have found works best is to create the root web application, let’s say SharePoint-80 , in the test system and if you want, create a site collection and navigate to it to make sure all your install efforts have not been in vain and everything is working. Then backup and restore your production root web app content DB to the test instance and overwrite the root site DB with the same name. Once you’ve done this you can add the content database through the Central Admin GUI. That should be that, you should now be able to navigate to the root site and there should be all your production data. Migrate any other content databases as needed and add through GUI.
Customisation
Now this part will depend on the type of customisation you have gotten your hands dirty with. If SharePoint designer is your friend and most of your customisations have been through designer you should make pretty short work of it. These customisations will be stored in the content databases you have already migrated. Any custom web parts or features used in production will have to be migrated into the test file system (GAC/bin/hive directory). You also have to install and activate any features you whack in the hive – just because they are in there doesn’t mean the job is done. If you have wrapped up all your customisations in lovely little solutions that you must now set to work deploying those (well done SharePoint nerd). If you have been a good developer you won’t come across any nasty dependencies which dictate in which order you deploy your solutions. Lastly, if you are a bit naughty sometimes and make changes to files in the hive directory (like blog site templates etc) then you need to make sure those files have been migrated from production too. I tend to apply these customisations across all SharePoint servers in the farm even if they are not WFEs. That way, if you ever need to swap one in for a sick WFE, its easy peazy.
May 15, 2009
InfoPath Submit Error- A value in the form may be used to specify the file name
Posted by mossipqueen under Errors, InfoPath | Tags: Errors, InfoPath |[4] Comments
This is the full error you will see in your logs at the time of submission : InfoPath cannot submit the form. An error occurred while the form was being submitted. A value in the form may be used to specify the file name. If you know the value in the form that specifies the file name, revise it and try again. Otherwise, contact the author of the form template.
There are two possible causes and solutions for this error:
1) You are trying to submit a form that has already been submitted to a document library or the form you are attempting to submit has the same name as an existing form in the library. Solution – either ensure the form is being submitted with a unique name e.g. append and date time stamp to filename specified in the Submit data connection (wizard) OR check the Allow overwrite if file exists check box, so that the form can be overwritten if it already exists in the Document Library.
2) You are submitting the form to a SharePoint list instead of a form or document library. Solution – modify the Submit data connection and ensure that the Document library field contains a URL to a Document or Form Library and not a SharePoint List.
Update
I have been informed by an informer that it may also be due setting the form submit address to a form library view rather than just the library.
Also, another good post on this subject can be found here: http://claytoncobb.wordpress.com/2009/06/20/auto-generating-filenames-for-infopath-forms/