• Customizing a SharePoint External Content List with Infopath

    Anyone trying to customize the boring layout of an external list in InfoPath that you made in SharePoint, is warmly greeted with the fun loving error: “An unknown error has occurred. The form template has been published to the server but it can only be opened in InfoPath Filler.”


    The solution is far more simple than having to hard code anything like so many different sites claim. and I won’t go into the how-to’s for creating a Business Connectivity Service connection (BCS) or an External Content Type (ECT). As there are many other tutorials out on Google that will cover it well. A great resource is Clayton Cobb. He doesn’t fancy himself a coder so he actually speaks in a language I can understand. Links to his tutorials directly are the following: BCS & ECT 1 BCS & ECT 2 BCS & ECT 3

    To get right to the heart of the issue, let’s look at the error itself. “An unknown error has occurred. The form template has been published to the server but it can only be opened in InfoPath Filler.” It doesn’t tell you much at all. Except that it doesn’t like it when you try to upload the InfoPath form (template.xsn). When we push that button in SharePoint Designer to convert the External List to an InfoPath form,


    it creates a new folder called “Item”. Then adds the following files to it: displayifs.aspx, editifs.aspx, newifs.aspx & template.xsn. IT also sets the new .aspx files as the default views for the list and the template.xsn file holds all the InfoPath form data for the list.

    With that said, open SharePoint Designer in file view and navigate to the list folder containing the new files. Once there, and with the list already open in InfoPath, delete the template.xsn.

    Now, magically, you can save your new InfoPath form without issue.
    Don’t do your happy dance just yet though! If you try to add/modify/view the items in SharePoint, you’ll get an error. Two things need to happen now.
    1) In InfoPath, create the corresponding views of the item views in SharePoint (New, Edit and Display). Then save the template.xsn file.


    2) Modify the three new .aspx files in SharePoint Designer to point to the new InfoPath template.xsn file by highlighting the list web part and changing the value of FormLocation to the correct location. See the field in the top right corner of the pic below.


    Then in the web part properties of each, set the view to match the corresponding file type.

    Save each of the .aspx files and enjoy your new fully customized external content list form in all it’s glory. *BAM*

  • SharePoint WSS 3.0 Migration Process to Sharepoint 2010 Foundations

    With the newly released SharePoint 2010. I had an excellent opportunity to get approval to migrate to the new environment. I wanted to utilize the new features available for future projects that I have been developing in preparation.

    The environment I’m moving, consists of about 110 subsites in one site collection. A single app/front end server attached to a stand alone SQL server. The content database is approximately 4 gigs. So, all in all, a quite small environment. But it is the focal point for collaboration for the company. customized fairly extensively to meet the needs of the different departments. Also, it has been pushed out in group policy as all 14,000 employees’ home pages. Obviously, this migration has to be performed smoothly and quickly. Below is a detailed process I developed while planning the migration. Also, I included a development (2nd tier) server to move the WSS 3.0 environment to in order to clean it up before the migration.

    I have to say first off, that the pre-upgrade check failed. But a detailed analysis showed the features that failed, were not going to be used in the new environment. So that in itself would not have proved the migration process a failure, but would cause the pages they were used on, to show as unavailable or broken. The catch with plugins is that even if they are uninstalled and removed from the original environment, the feature reference will remain within the default.aspx pages they were used on in a site by site basis. After migration, the default.aspx pages can be accessed in SharePoint Designer 2010 and opened in advanced mode. From there the feature references can be removed.

    Pre-upgrade Preparation
    Communication regarding the migration is going to be essential to the success of the project. Without the assistance of the end users, you will find you will probably have more functionality and process bugs than you can handle at one time. As this update comes with a significant visual upgrade, putting your SharePoint’s best foot forward is essential. You will want the migration to be as pain free as possible for the end users. Help them know what to expect as this is a new roll out.

    Discuss with Designers, the purpose of migration, new functionality and their required cooperation with the sites they are responsible for, to assist in locating issues on their sites.
    Step 2
    Migrate the site over to Foundations and test navigation & functionality.
    Step 3
    Resolve breaks on front end servers.

    Upgrade Preparation

    Step 1
    STSADM-backup site collection from production environment.
    Step 2
    Xcopy .dat file to WSS 3.0 development server.
    Step 3
    STSADM-restore site collection to development server.
    Step 4
    Remove custom web parts and customizations that are incompatible with Foundations.
    Step 5
    SharePoint Designer 2007 – default.aspx – remove 3rd party web part references from the master default.aspx file of sites that have been modified by the webpart.

    Anonymous Access
    If anonymous access has been enabled on the original production environment and needs to be receded, it would be a preferable practice to disable this feature on the development server before the step of restoring the site to the development server in the migration process. Once anonymous access is disabled, it will automatically remove the access to all sites configured for anonymous access.

    Step 1
    Disable anonymous access within Central Administration and set permissions on top level site to have domain users as read only users.
    (done automatically on the move to the dev server as Anonymous is already disabled.)
    Step 2
    Set all sites that originally had Anonymous access to a read only Active Directory security group such as “SP_Read”.
    (There will be spots that will be missed as there are detached subsites that will have had anonymous access calendars, etc. Will need to coordinate with Content Admins to have them verify their site is fully functional)

    After the restore to the development server has been complete and resolving any inconsistencies in the WSS 3.0 environment, the migration process can occur.

    Step 1
    Stop and detach the WSS 3.0 content database of development SharePoint environment in SQL Server.
    Step 2
    Xcopy database & log files to BI SQL Server.
    Step 3
    Attach WSS 3.0 database to BI SQL Server.
    Step 4
    Create web application in central admin on new production server.
    If already exists, delete existing content database within Central Admin.
    Step 5
    In PowerShell, perform a test migration to verify the database move & check log with following TEST script:
    test-spcontentdatabase -name corp-srce-dev-migration -webapplication http://newserverapplication/ >c:results.txt
    Step 6
    Mount Database to Web Application with the following script:
    mount-spcontentdatabase corp-srce-dev-migration -databaseserver corp-bi-sql2 -webapplication http://newserverapplication

    The WSS/Foundations environment does not have masterpage/navigation hierarchies inherent by default, because of this, the top global navigation bar is not by default configured as a universal navigation bar. This will need to be manipulated within the default.master and/or v4.master pages within the 14 hive. The default master pages are located here: C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATEGLOBAL*.master
    Step 1
    Modify current master page to include new navigation properties.

    Visual “4” Upgrade
    Due to WSS site templates not being inherent of the parent pages, they will have to be visually upgraded individually. When I performed the migration, the v4.master file was not put into the master page _catalog folders on each site. This will have to be copied in manually. To complete this process, the following steps must be followed:
    Step 1
    In SharePoint Designer 2010, copy the v4.master page into the _catalog folder of the site.
    Step 2
    View site within browser and set v4 view as permanent by setting visual up grade as permanent in site settings.

  • “Code Blocks are not allowed in this file.”

    This is one of those examples where Microsoft forgot to flip a switch in the web.config to get Business Intelligence (PerformancePoint Services) to work properly in Sharepoint 2010.

    You will recieve this error when you attempt to create a new dashboard within a Sharepoint Business Intelligence site. This error occours because PerformancePoint needs to run a server side script. By default, this is not enabled in the web.config.
    To Fix:
    1) Browse to your web directory (C:InetpubwwwrootwssVirtualDirectories*)
    2) Locate the tags
    3) Between these tags, include the following:

    You can now run code from any document library within your site. If you just want to allow it for a single page, like a master page, change virtual path (“/*”) to point directly to that page.

  • WSS 3.0 – Make an Uneditable Zone.

    I was given the task of figuring out how to lock down the contents of a Content Editor Web Part. On the top level of every subsite, we have a CEWP that states “For inquiries about content on this page, please contact this page’s Content Administrator: Name.” Whenever a site moderator goes and adds a new web part, it pushed this blurb down the page and the user can delete it all together. If they felt like it. Since a CEWP is not a data list or refrenced website, it will by default inherit the permissions of the parent site. So you cannot apply permissions to it in general within Sharepoint.

    The easy work around to this is to create a new Web Part Zone in the default.aspx and customize the configuration of it within Designer.

      See Link Below

    Lock Permissions to a Zone

  • WSS v3 – Calendar – Forcing More Than 3 Events Per Day

    For those that are just too lazy to press the “Expand All” button above a SharePoint calendar, there is an easy way to set the default to a higher number. The calendar only shows 3 events per day before you have to click on the expand arrows, you can however change this number by modifying a section of the DefaultTemplates.ascx file located in:

    C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATECONTROLTEMPLATES

    Before you make any changes to this file make sure you take a copy of it in case you make any mistakes.

    Within this section you’ll find a declaration
    for the MonthlyCalendarView which should look like this:

    ExpandedWeeks=’<%# SPHttpUtility.HtmlEncode( DataBinder.Eval(Container,"ExpandedWeeks","")) %>‘

    Once you’ve made the change to the file & saved it you’ll need to do an IISReset for it to take effect.

  • WSS v3 – Trusted Site Authentication & DN Registration within WSS

    IE Auto login or Pass-through authentication has just a couple rules:

    1) Any address, added to internal DNS or even your own computer, that includes a “.com” in it, will make the browser think its outside the network and thus disable the passthrough authentication from your domain.

    2) Pass-through Authentication must be enabled within IE. “User Authentication” can be pushed out via a group policy if you wish.

    (Yes…I made the horriffic mistake of installing IE8. The gnomes made me do it!)

    pass-through authentication 1

    ***NOTE: The downfall to this is if it IS enabled, WSS will not pull any data from Active Directory excluding username & password. Email addresses and other AD account values will not pull across into the User Information List. Take the good with the bad.

    On the SharePoint site, you also might want to give your site a title coolname.domain.com. In which case…you make the modification, here… (oh yeah, a restart of IIS services may be needed)
    access mappings

  • WSS v3 – Adding PDF Indexing and Show PDF Icon

    After a bit of mucking about with the Searching & Indexing setting, I will explain about this in another blog entry soon, I got the site search to work correctly.

    icon_pdfI noticed that PDF documents weren’t being returned in any of my searches.  Not only this but it also appeared that PDF files were totally unsupported in MOSS as they would not display an icon in my document libraries.

    This is because when MOSS crawls content it needs to open each document to index its contents, it does this by using an iFilter (very Appleesk).

    You can get PDF iFilters from Adobe but a company called FoxIt have released both x86 & x64 versions of a PDF iFilter.  You can download that from their website.  www.foxitsoftware.com

    Adding a Document Icon

    1. Save a copy of an image you wish to see as the PDF document icon to “Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TemplateImagespdf.gif” – Images should be 15×15 pixels in size.
    2. Navigate to “Program FilesCommon FilesMicrosoft SharedWeb server extensions12TemplateXml”
    3. Edit “DOCICON.XML” in notepad
    4. Add the following line <Mapping Key=”pdf” Value=”pdf.gif”/>
    5. Open a Command Prompt and type “iisreset”  – NOTE : this will temporarily stop MOSS from being accessed while IIS restarts.

    iFilter Installation Steps

    1. Stop the IIS Admin service(s) – NOTE : No one will be able to access MOSS until after Step 3 has been completed.
    2. Install FoxIt’s iFilter on all indexing servers
    3. Open a Command Prompt and type “iisreset”
    4. Open the MOSS Central Administration Site
    5. Go to the Share Service Administration Site running the search service
    6. Select “Search Settings”
    7. Select “File Types”
    8. Select “Add New File Type”
    9. Enter “pdf” click OK
    10. Now run a Full Crawl
    11. Check the Crawl Log to see that PDF files are successful indexed

    Thanks to Matt for this patch documentation!

  • WSS v3 – Custom Theme.css Refrenced By One Source!

    One of the major drawbacks of SharePoint themes is you have to reapply the theme to any site that uses your custom theme in order to see any new changes that you have made.  This happens because when you apply a theme to a SharePoint site, a copy of the theme is added for the site in the content database. 

    Try it out, open a test site in SharePoint Designer and look at the folder structure in the Folder List task pane.  If you have already applied a theme to this site, you will see a _theme folder. If you have not applied a theme to this site, then this folder will not appear.  Expand the folder and you will see a single sub folder named the same as your theme.  Now go and change the theme the site uses through a browser.  Return to SharePoint Designer and hit F5 to refresh the Folder List.   The _theme folder will appear if you didn’t have a theme applied the first time, and the sub folder under this directory will change to reflect the theme you just applied.

    When you make a change to the theme files on the web server, it does not update any copies of the theme that live in the content database.  When you apply a new theme in the browser, it replaces the copy in the content database with a new theme.  That is why you have to physically reapply a theme when you make changes, you have to replace the theme copy in the content database.

    From a development perspective, the theme copy in the content database is rather handy.  If you update any of the files in the content database (by changing the CSS files in SharePoint Designer and importing in new images), the changes automatically appear in the browser. Woo-hoo! This just made life easier when it comes to developing themes.

    But after you finish up development, you are stuck back with the problem of how to update your theme in the future, especially if it is applied to several sites.  This is where this trick comes in.

    Import CSS to Create Editable Themes

    Create a copy of the final theme.css file and store it in another location on the web server, such as:
    C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS1033STYLESYOURCUSTOMFOLDERHERE
    You can even rename the file, it no longer needs to be named theme.css.

    Open the original theme.css file in the custom theme folder, delete out all of the contents, and add an import rule for your new CSS file:
    @import “/_layouts/1033/styles/YOURCUSTOMFOLDERHERE/theme.css”;

    Save the file and deploy your theme (add text to SPTHEMES.xml and reset IIS).   Apply your new theme to the site.  Now go to the new CSS file in the Styles folder and make a change.   Refresh your browser.  Your change will appear.  That is cool.

    By moving around your files and using the import rule  you can create a theme that you can update without reapplying the theme to every site that uses it.  Be sure to update your image paths in your CSS styles to a location where you can edit the images as well, such as:
    C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEIMAGESYOURCUSTOMFOLDERHERE 

    Below are a couple of screen shots for the end result of this method.

    View of the file structure on the web server


    View of the theme folder and the theme.css file that is still in the theme folder

    Thanks to Heather Solomon and her awesome customization skills!

  • WSS v3 – Custom Site Theme for WSS 3.0 & 2007

    The easiest and the fastest way to apply the same look and feel on any SharePoint site is creating a site theme. A SharePoint site theme basically consists of theme.inf, theme.css, and image files. Theme.inf file simply represents the title of the theme. Theme.css is a stylesheet file that defines colors, header images and layouts of a site and image files can be referenced here to display on the page. By creating a custom site theme, you can easily change the style but in fact, writing and editing the stylesheet can be somewhat chanllenging when you have more than a hundred of elements to deal with.

    Here is a short procedure of creating a custom site theme named “Ghost”:

    1. Copy any theme folder in “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATETHEMES” folder and paste with its name replaced with “Ghost”. In this example, copy GRANITE folder.

    2. In Ghost folder, rename GRANITE.INF file to GHOST.INF in upper case.

    3. Open GHOST.INF file with notepad.

    4. Change the value of title under [Info] to Ghost.

    5. Replace every word, Granite, under [titles] with Ghost.

    6. Open “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS1033SPTHEMES.XML” file with notepad.

    7. Add the following lines under <SPThemes> tag:
      <Description>Ghost theme.</Description>
    Notice that preview and thumbnail paths are images/thghost.gif. By default, MOSS 2007 and WSS 3.0 will not have such image files.

    8. In order to display thumbnail and preview correctly, you will need to capture the screen and save the file in “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEIMAGES” folder with thghost.gif name. You can change the .gif file name if you change the thumbnail and preview file names in <Templates> tag.

    9. Do an iisrest for the server to recognize the new theme.

    Pretty simple procedure. Now you are ready to test your new theme. In Site Settings, you can now choose Ghost theme; however, the theme will not differ from Granite theme. Now, it is time for you to play with theme.css file!

  • WSS v3 – Adding Line Break to a Survey

    I came across this little issue this week and found a solution that tested successfull. It is quite easy to implament. The only possible downside is that it isn’t going to effect the entire site collection if the heiarchy is broken….

    Thanks! Mark Deraeve

    by mderaeve 23. May 2009 02:37

    A user is trying to make a survey. Now, she needed to create a header for each new page in the survey. She tried to use the textbox and hit enter in the question field, that’s what I would do to. And it appears as if the enter are accepted. But when you look at the question, you will notice that the line break disappeared. As I was looking for a solution, I found that in the previous version, this was possible but not in WSS 3.0! So after looking a little more, this site gave a good solution, I decided to use it, but with a slightly different approach.

    The thing is that we will implement a javescript that will look for elements with classname : ‘ms-formlabel’. Then it will replace the word linebreak with a <BR>. This solution you can find on the site I mentioned above. But they suggest to place a content editor webpart on each page that uses the survey, like the newform.aspx of each survey. Since I’m using a WSS site specially for surveys, I don’t want to do this every time I create new survey. So I added the code to the default masterpage of the site. In the head section of the page I placed a function called: setLineBreaks()

    <HEAD runat="server">
                function setLinebreaks()
                            var className;
                            className = 'ms-formlabel';
                            var elements = new Array();
                            var elements = document.getElementsByTagName('td');
                            for (var e = 0; e < elements.length; e++)
                            if (elements[e].className == className){
                            elements[e].innerHTML = elements[e].innerHTML.replace(/linebreak/g,'<br/>');}

    Then I call this function on the pageload event like this (the code I added is in bold):

    <BODY scroll="yes"
    onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();setLinebreaks();">

    So now every time you enter the word linebreak in a question a new line will be started. (It will be replaced with a <br>)

    Some screenshots of the results: