My SharePoint Blog

Blogs On SharePoint Technologies


Search Site

Recent posts

Recent comments

Tags

Don't show

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Running Code Blocks In Your SharePoint ASPX Pages.

    You may see this error:

    An error occurred during the processing of /test.aspx. Code blocks are not allowed in this file.

    Reason:  SharePoint does not allow server side code to execute in aspx pages contained in the SharePoint site.

    Fix:  Edit the web.config (I.E. C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config) file:

    <PageParserPaths>
            <!-- To allow a single file: -->
            <PageParserPath VirtualPath="/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />
            <!-- To allow global: -->
            <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
            <!-- To allow global within a subsite: -->
            <PageParserPath VirtualPath="/websitefoobar/*" CompilationMode="Always" AllowServerSideScript="true" />
    </PageParserPaths>

    Categories: SharePoint
    Posted by Kevin on Tuesday, January 29, 2008 12:04 PM
    Permalink | Comments (0) | Post RSSRSS comment feed

    SharePoint Lists Filter Keywords and Expressions In Views

    [Today] The current date.

    [Me] Current User of the site.

    [Modified] Date item was last modified.

     

    Filter Expression Examples: 

    [Modified]+7  A week after the last modification.

    DATE(YEAR(Modified),MONTH(Modified),DAY(Modified)+5)  5 Days after the last modification. 

     

     
    Formulas and Functions:

    http://office.microsoft.com/en-us/sharepointtechnology/CH100650061033.aspx


    Categories: SharePoint
    Posted by Kevin on Tuesday, January 29, 2008 10:30 AM
    Permalink | Comments (0) | Post RSSRSS comment feed

    SharePoint Escape Characters

    Ran into a problem when I was writing script to add a new entry to a column (using XML web services). I could not get the column names the same as the were name. Like my "e-mail" column. So for that one I had to type for the id in the script e_x002d_mail.

    Blank space: _x0020_
    Underscore: _x002d_
    Dash: _x0027_

    Here is the Format:

    _x00[the escape code]_


    Char         Code 

    [space]      20
    <            3C
    >            3E
    #            23
    %            25
    {            7B
    }            7D
    |            7C
    \            5C
    ^            5E
    ~            7E
    [            5B
    ]            5D
    `            60
    ;            3B
    /            2F
    ?            3F
    :            3A
    @            40
    =            3D
    &            26
    $            24

     


    Categories: SharePoint
    Posted by Kevin on Tuesday, January 29, 2008 10:14 AM
    Permalink | Comments (0) | Post RSSRSS comment feed

    Create a custom list form for a SharePoint list

    1. Open your site in SharePoint Designer.
    2. Browse to your list and open the 'NewForm.aspx' web form.
    3. Go File -> Save As... and give the form a new name such as 'NewForm2.aspx'.
    4. Hide the default List Form Web Part from the page (do not delete it!!).
      1. Right click the List Form Web Part -> Web Part Properties -> expand Layout -> check Hidden.
    5. Go Insert > SharePoint Controls -> Custom List Form.
    6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
    7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show "Error Rendering Control" but this does not affect the final result).
    8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
    9. At this point, you can do other customisation such as rearranging the fields if you wish.
    10. Save the site.

    To make the new form the default form:

        1. Open the site in SharePoint Designer.
        2. Right click the list in the Folder List and select Properties.
        3. Go to the Supporting Files tab.
        4. Use the Browse button to enter the path to your new Edit item form.

    Note: To redirect after the form is submitted, use the following syntax in your misc links that point to the new form...

    http://portal.example.com/Lists/YourList/NewForm2.aspx?Source=http://portal.example.com/redirectpage.htm

     


    Credit:

    http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html

    http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx 

      

    Problems: ("Invalid page URL"), see these articles:

    http://support.microsoft.com/kb/935504

     

    Gotchas:

    • Do not delete the default List Form Web Part from the page, "Hide" it!  You will get "Invalid page URL" errors if you delete it from your modified newform.aspx.
    • I have discovered that if you create a new item (that uses your modified NewForm.aspx) in a folder of a list, the new item is placed at the root of the list rather than the folder your created the item in.  I have an open Microsoft Support Ticket on this and will update this blog when it resolved.  Update: The have now issued a known bug and put it on their "fix list".  No word on when it will be patched (probably next service release).

     


    Categories: SharePoint
    Posted by Kevin on Wednesday, January 09, 2008 1:43 PM
    Permalink | Comments (10) | Post RSSRSS comment feed