I recently had to write code to check if a page in the page library was already checked out, so that I can force the check in and publish it with comments.
The one that was hard to find was how to inspect in which state the page was in (checked out, published, draft, etc).
In the end, looking through the object model and after a while I found this pearl in the file object
pubPage.ListItem.File.Level ==
The possible values for this Level object are
SPFIleLevel.Checkout
SPFileLevel.Draft
SPFileLevel.Published
Hope this helps someone
Other Tags: Find out if SharePoint item is checked out; isCheckedOut;
I am not sure if this is a bug in IE8 but we have found that in certain sites when we copy and paste a password in the password field then IE8 fails to logon to that site. We have experienced this in a Windows 7 machine with Internet Explorer 8.
It seems that if you start typing the user name then you cannot paste the password in the field.
This is how we have worked around this:1. pasting the password and then typing the username2. pasting both the user and the password3. the obvious one, typing both fields.
We have spent various hours trying to figure this out as we have an application that creates users and passwords automatically and we thought that there was something wrong with our AD routines... it turns out that this may be an IE8 bug.
Hope this helps someone and that Microsoft comes up with a fix for this if this is a bug
We have found that when you add the WebUrl parameter to a data view – or the SPDataSource to be more exact (see below) to show the contents of a list from a different web to the current one:
<WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="<your-web-url>"/>
and refresh the page in your browser, then you find these hideous messages in your SharePoint logs that look similar to this:
“An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. Allocation Id: {42A8CB1F-D1B6-41FA-9E2A-B1D64B4F5ADA} To determine where this object was allocated, create a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings. Then create a new DWORD named SPRequestStackTrace with the value 1 under this key.”
Steps to Reproduce:
(I assume that you have experience setting up data views)
STEPS TO REPRODUCE:
SETUP
1. Create 2 webs in a site collection from a Team site template (this will create the announcements list). For example
http://yourserver/sites/products/remote
and
http://yourserver/sites/products/local
2. Open SharePoint Designer (SPD) and open the web in /sites/products/local.
3. Add a data view web part to this page and point to the out of the box announcements list (in the local web)
4. Save the page and go to the browser to view the results.
5. Inspect your sharepoint log and you should NOT see any of the above error messages
CHANGE THE ListName
1. Still in SPD in the local site. Go change the definition of your data view to point to the list name rather than to the ListID (this is important for the next step)
2. Find the the <selectParameters> node in the code window in SPD and change the parameter for ListID to ListName and the guid of the List to the Name of the list
your web part definition should look like this (the bits that have changed are highlighted):
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View></View>" id="dataformwebpart2">
<SelectParameters>
<WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/> </SelectParameters>
2. Save and refresh your browser page
3. inspect your log and it should still NOT have the above error message.
POINT TO THE WEBURL
1. Still in SPD in the local site. Add a new DataFormParameter to point to the 'remote' site.
2. Add a new node to the <SelectParameters> xml node
<WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="/sites/products/remote"/>
3. your web part definition should look like this (the new node is highlighted)
<WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/></SelectParameters>
3. inspect your log and you will see the memory leak message.
(I think the SPDataSource component is opening an SPWeb or SPSite object and it is not being disposed correctly when the connection is closed. This is a common error/issue with .net applications.)
We are looking at alternatives right now as this is causing issues with an intranet, specially since these web parts are in the master page so every page request causes this issue. Will keep you posted.
If you ever get a message from a contact details web part
“Cannot save the property settings for this web part. One or more errors have occurred. See below for details.”
Well, the message see below for more details… but there is nothing else.
I found that when you try to add a user to the contact details web part that DOES NOT have a user ID in the site collection this problem occurs. In our case, we had configured All Authenticated users so there was no named users in each of the SharePoint groups.
The workaround that I tried was:
1. Add the user to one of the groups (say the Reader group)
2. set the contact details web part
3. remove the user from the group
Adding and then removing the user creates a user Id in the site collection.
I have a feeling, though I have not confirmed this, that if the user visits the site collection the first time, the user id is created and thus this problem would not exist.
Hope this helps someone out there.
I recently had this issue with the SPQuery object returning all rows in the list even when I knew that the query was correct.
I Used CAML creator from U2U to construct the query, then remove the <Query> tags around it and then tested it on a windows application. This worked.
Since I needed this to work inside the _layouts directory, I converted the code and placed it in an aspx page in the LAYOUTS directory
Initially it complained about the < and > in the query string, so I decided to escape the string with < and > as per below…
string sQuery =
"<Where><Eq>" +
" <FieldRef Name='Author' /><Value Type='User'>Joe Bloggs</Value></Eq>" +
"</Where>" +
"<OrderBy><FieldRef Name='Author' /><FieldRef Name='ID' Ascending='False' /></OrderBy>";
SPQuery oQuery = new SPQuery();
oQuery.Query = sQuery;
SPListItemCollection items = listLP.GetItems(oQuery);
However, every time we executed the page, the SPListItemCollection returned ALL items in the list… after reading lots of blogs and forums everyone pointed out to an incorrect query string… eventually after a bit of grief we realised that the string should be constructed this way and NOT escaped:
@"<Where><Eq>" +
" <FieldRef Name='Author' /><Value Type='User'>Joe Bloggs</Value></Eq>" +
"</Where>" +
"<OrderBy><FieldRef Name='Author' /><FieldRef Name='ID' Ascending='False' /></OrderBy>";
Once we did this change, the items collection is correctly populated.
The fix is simple, you need to go into Central Admin > Operations > Convert license type
Then type your appropriate license key.
Here is the blog article from the SharePoint team for more information
http://blogs.msdn.com/sharepoint/archive/2009/05/21/attention-important-information-on-service-pack-2.aspx
Try the interactive tools
Stsadm Technical Reference for SharePoint Server 2007: http://technet.microsoft.com/en-us/office/sharepointserver/cc948709.aspx Stsadm Technical Reference for Windows SharePoint Services 3.0: http://technet.microsoft.com/en-us/windowsserver/sharepoint/dd418924.aspx
I recently found that the top navigation links in a SharePoint site don’t highlight the active tab. After a few tries I realised that the links in the Url field need to be “clean”.
I had initially a Url with %20 characters in there and other with / at the end of the string.
Once I removed them from the Url field, the active tab started working.
Hopefully this helps someone.
(PS: I was using sp2 in this environment)
This works for both rich InfoPath forms and web forms, not sure if this will work for mobile forms.
Follow the steps exactly, including the name of the group and fields with EXACTLY the same case (it is case sensitive)
http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx
The instructions give you the steps for adding one field only, but if you want to add more than 1 field then you do the following:
1. go to the Data source pane and add a new group for the field that you want to capture. In my case Approver 3.
2. Go to the gpContactSelector field that you originally added and select “Reference”
3. Then select the group that you just added (in my case Approver 3)
Now you have multiple people picker fields.
As promised, here are the sessions that we demonstrated this weekend at the conference. I hope you found them informative and you took away good points and tips.
1. Dataview tips and tricks (creating a relative list dataview and a remote list viewer)
http://www.livepoint.com.au/Downloads/RapidFire%20-%20Dataview%20Tips%20and%20Tricks.pptx
2. Custom Site Maps
http://www.livepoint.com.au/Downloads/RapidFire%20-%20Custom%20Site%20Maps.pptx