Tuesday, May 19, 2009
WSPBuilder Fails to Copy Assembly to GAC
For this one particular web part assembly, when selecting that WSPBuilder "Copy to GAC" option from the context menu in Visual Studio, the copy operation failed with the following message:
System.BadImageFormatException: The module was expected to contain an assembly manifest
Examining the references in that Visual Studio project, I found that one reference for some reason had the "Copy Local" property set to True. By setting this to False (and thereby matching the settings for all the other references), the assembly successfully copies to the GAC using WSPBuilder
Thursday, April 30, 2009
And I Quote, “Problem I Find With SharePoint…”
Just been reading a newsgroup posting in which the author recommends to “avoid SharePoint” as a CMS and to “build your own so it can adapt and fit 100% into your business”.
Why that suggestion? Judging from the rest of the post it seems to boil down to this - “Problem I find with SharePoint is it allows everyone to become a publisher and sites quickly get out of control with everything being dumped on it”.
Could rephrase that sentiment as “problem I find with a hammer is that it allows everyone to knock in screws and so splits the timber”. SharePoint is but a tool. And as a tool, it needs policies and procedures in place to give guidance and control over its usage.
SharePoint doesn’t allow everyone to be a publisher – the IT department who deploys it or the power users who configure it are the ones who can decide to allow everyone to become a publisher.
It’s the same with any corporate software tool or platform; governance and planning are vital from the very start of the implementation cycle. As is gaining a thorough understanding of the tool.
Tuesday, April 7, 2009
SharePoint Custom Field - jQuery Script in a List Form
Useful for making minor rendering changes to controls and text in the new item, edit item or display item forms in a SharePoint list. The field has a custom editor which accepts the script to render on selected forms. Here's a screenshot of the field editor
Thursday, April 2, 2009
The "Open With Windows Explorer" Action Fails - Nothing Happens!
This occurred for me when attempting to view documents in a Windows Explorer view on a Server 2003 box - the Explorer view simply would not open even though the option was available. Temporarily enabling and starting th WebClient service (using the Services administrative tool) instantly cured the problem. I stopped the service on completion of the use of Explorer, as it may present a potential security vulnerability.
The Webclient service not running also prevents you from adding a Network Drive mapping to SharePoint lists and libraries through the Add Network Place Wizard.
Thanks to a posting from Mart Muller for this fix.
Thursday, March 26, 2009
Missing Page Editing Toolbar? Breadcrumb Links Wrong?
- The Page Editing toolbar was missing on publishing pages. The toolbar did not display when the "Edit Page" option was selected on the site actions button
- The "Show Page Editing Toolbar" option was greyed out (disabled) in the Site Actions menu
- The links to the site home page in the breadcrumb trail and from the tab in the top navigation bar failed to open a page (page not found)
For more on AAM, see the excellent series of articles named "What every SharePoint administrator needs to know about Alternate Access Mappings" on the Microsoft SharePoint Team Blog:
Thursday, March 5, 2009
Building a Query Web Service Call Declaratively in a Data Source
Couldn't seem to get any way of injecting search text inside a CONTAINS or FREETEXT predicate within the SQL search statement being sent to the query web service. Finally opted for a string construction technique - defining the start and the end of the SQL search statement in parameters in the datasource, and gluing these together around the search text term inside the selectcommand node. Surely their is a cleaner way than this - I must be missing something obvious here?
<DataSources>
<SharePoint:SoapDataSource runat="server" SelectUrl="http://someserver/sites/DC/_vti_bin/search.asmx" SelectAction="http://microsoft.com/webservices/OfficeServer/QueryService/QueryEx" SelectPort="QueryServiceSoap" SelectServiceName="QueryService" AuthType="Windows" WsdlPath="http://ssc-moss:200/sites/test/_vti_bin/search.asmx?WSDL" XPath="" ID="SoapDataSource2">
<SelectCommand>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<QueryEx xmlns="http://microsoft.com/webservices/OfficeServer/QueryService">
<queryXml>{queryXmlStart}"{QueryText}*"{queryXmlEnd}< / queryXml>
/QueryEx> /soap:Body> < /soap:Envelope> < /SelectCommand><SelectParameters>
<WebPartPages:DataFormParameter Name="queryXmlStart" ParameterKey="queryXmlStart" PropertyName="ParameterValues" DefaultValue="<QueryPacket xmlns="urn:Microsoft.Search.Query"><Query><SupportedFormats><Format>urn:Microsoft.Search.Response.Document:Document</Format></SupportedFormats> <Context> <QueryText type="MSSQLFT" language="en-us">select preferredname, firstname, lastname, workemail, workphone, homephone, Title, Path, OfficeNumber, ActiveAsText, jobtitle, pictureurl, description, write, rank, size from scope() where "scope"= 'People' and CONTAINS(DefaultProperties,'"/>
<WebPartPages:DataFormParameter Name="queryXmlEnd" ParameterKey="queryXmlEnd" PropertyName="ParameterValues" DefaultValue="') and firstname != '' order by preferredname asc</QueryText> </Context> <Range> <StartAt>1</StartAt> <Count>1000</Count> </Range> <EnableStemming>true</EnableStemming> <TrimDuplicates>true</TrimDuplicates> <IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery> <ImplicitAndBehavior>true</ImplicitAndBehavior> <IncludeRelevanceResults>true</IncludeRelevanceResults> <IncludeSpecialTermResults>true</IncludeSpecialTermResults> <IncludeHighConfidenceResults>true</IncludeHighConfidenceResults> </Query></QueryPacket>"/>
<WebPartPages:DataFormParameter Name="QueryText" ParameterKey="QueryText" PropertyName="ParameterValues" />
< /SelectParameters> < /SharePoint:SoapDataSource> Note that the QueryText parameter is added as a Parameterbinding with location of "QueryString(qt)", meaning that the datasource will use any text in the querystring parameter named "qt" as the search text submitted to the query service.
The drawback of this is that if no default value is defined for the QueryText parameter then this dataview will show an error when no qt querystring value is supplied.
The benefit of this technique, however, is the ability to add quotes and wildcard search characters to the queryXML string in order to achieve the required search SQL
Sunday, February 15, 2009
Note Field Removes Script (and Inline Style) When Saving
Further investigation showed that when a list item with note fields is saved, any blocks of text that resemble script are removed from the rich text in the note fields. This occurs either when saving the item through a form in the browser, or when using the "update()" API method.
The process that removes script sometimes gets too eager to "cleanse" the HTML - I found that it was removing the following inline style (not my HTML design, I hasten to add!):
BACKGROUND-IMAGE: url(http://some.site/info/communications/PublishingImages/box_1024.gif);
I didn't experiment further with this style to see whether adjusting the exact text (for example, adding quotes) might mean it was retained.
