5/17/2009

SharePoint 2010 News!

 

Search the web… lots of rumors out there… (and by the way, it’s now just “Microsoft Server 2010”, no more MOSS)

 

The “Official” Sneak Preview Site:  watch these videos!

http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx

 

Some videos from Partner’s Conference in New Orleans:

Visio Services
http://www.youtube.com/watch?v=pW-AjRO5YyY

Access Services
http://www.youtube.com/watch?v=79D_r17fnnA

Microsoft SharePoint Workspace 2010
(And if you watch carefully you will see some “home page” screens and some interesting stuff in the Site Actions menu)http://www.youtube.com/watch?v=QNUxYjFJEs4

 

Blog articles… (popping up everywhere!)

http://knowledgeforward.wordpress.com/2009/07/18/a-first-look-at-sharepoint-2010/

http://kalsing.blogspot.com/2009/07/accessing-business-data-with-sharepoint.html

 

 

Here’s something that‘s at least “official”:

Announcing SharePoint Server 2010 Preliminary System Requirements

http://blogs.msdn.com/sharepoint/archive/2009/05/07/announcing-sharepoint-server-2010-preliminary-system-requirements.aspx

 

And in preparation for Server 2008:

Windows Server 2008 and SharePoint Resources

http://blogs.msdn.com/sharepoint/archive/2008/01/16/windows-server-2008-and-sharepoint-resources.aspx

 

Computerworld says 2010 (invitation-only) beta due in two months:

http://news.idg.no/cw/art.cfm?id=48E662D2-1A64-67EA-E4337461F8125E8C

 

ZDNet: 201 will have a “Ribbon”, Silverlight, more search options:

http://blogs.zdnet.com/microsoft/?p=2761&tag=nl.e539

SharePoint: STSADM notes

 

  • A new Silverlight based help tool!
  • Charts!
  • A GUI!
  • A speed up!

 

A new Silverlight based help tool!

This is a pretty cool tool to both browse the commands and documentation, but to also see what’s new in each service pack.

For WSS:
http://technet.microsoft.com/en-us/windowsserver/sharepoint/dd418924.aspx

For MOSS:
http://technet.microsoft.com/en-us/windowsserver/sharepoint/dd418924.aspx

Charts!

Microsoft has wall sized charts for WSS and MOSS STSADM commands:

Remember… STSADM is extendable and will generally have commands added with each service pack. Here’s how to add your own extensions (for .Net developers!):
http://msdn.microsoft.com/en-us/library/bb417382.aspx

Some examples of additional STSADM commands:

http://stsadm.blogspot.com/

 

Microsoft Reference

A list of STSADM commands and documentation is here:
http://technet.microsoft.com/en-us/library/cc263384.aspx

 

A GUI for STSADM!

“stsadmWin 2007 is here”http://blogs.msdn.com/ronalus/archive/2007/01/04/stsadmwin-has-an-2007-version.aspx

 

STSADM slow???

http://www.dynasign.nl/blog/?p=9

5/16/2009

SharePoint: A better Yes/No field for surveys and lists

 

The out of the box Yes / No column type in SharePoint just displays a checkbox with no text next to it. If you are using it in a survey then you have biased the question as the field is either pre-unchcecked or pre-checked. (and it defaults to YES!)

The workaround? Just use a Choice field with two choices “Yes” and “No”. When used in surveys the end result is exactly the same as Yes/No and it defaults to neither choice selected.

And, you can be more verbose when needed: “Yes I agree” / “No I don’t agree”.

 

Both a normal Yes/No and the Choice Yes/No in a survey (or list) form.

The survey report:

5/15/2009

Silverlight: A few notes on HTML / JavaScript access from Silverlight

 

You can call into a Silverlight control from JavaScript in the HTML page and access Silverlight managed code properties and methods. The process is relatively straight forward really lets you use a Silverlight object as a true control, and not just a fancy animated advertisement (Sorry Flash designers…)

I will follow shortly with notes on the other half of the picture, accessing HTML objects and JavaScript functions from Silverlight code.

 

 

Accessing data / method in Silverlight from JavaScript

Step 1:  Add a reference

Add a reference to System.Windows.Browser, and add a using or Imports to your code file.

        using System.Windows.Browser;

 

Step2: Mark the item or class to be scriptable

The item can be either a property or a method. The attribute is [ScriptableMember] (<ScriptableMember> in VB.Net). Some examples show [ScriptableMemberAttribute], but the short form is preferred.

A sample property:

        private int x=9;

        [ScriptableMember]
        public int MyProperty { get { return x; } set { x = value; } }

 

The entire class can be marked as Scriptable using [ScriptableType], but note that all public members are then available for access from JavaScript.

See notes at the end of this article for more info on the use of the attributes.

 

Example:

or the entire class (warning: all publics are exposed)
[ScriptableType]
public class Calculator2
{
    public int Add(int a, int b)
       { return a + b; }

    public int Subtract(int a, int b)
    { return a – b; }
}

 

Step 3: Register the class as scriptable

Register the class as scriptable either in the app.xaml.cs, but more likely in yourpage.xaml.cs file.

Example if registered from Page.xaml

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            HtmlPage.RegisterScriptableObject("Page", this);

        }

Example to register another class:

         private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

            HtmlPage.RegisterScriptableObject("MyPage",  new Class1());

        }

 

Step 4: Make the call from the HTML page:

This example makes the call from a button, but could also be done from the <BODY> onload event or the Siverlight control’s load event.

    <script>
    function GetSomeData() {
        sl = document.getElementById("Xaml1");
        alert(sl.Content.Page.MyProperty);
     }
    </script>
    <button onclick="GetSomeData()" >Get Data</button>

or as a single line:
        <button onclick="sl = document.getElementById('Xaml1');alert(sl.Content.Page.MyProperty);" >Get Data 2</button>

or even...
        <button value="Get Data" onclick="alert(document.getElementById('Xaml1').Content.Page.MyProperty);" >Get Data 2</button>

 

Some observations and discoveries…

  • Both attributes are not needed!
    Some sources say that both the class must be marked as [ScriptableType] and the property or method must be marked as [ScriptableMember]. I found that just marking the class as [ScriptableType] made all public members script accessible. I also found that marking a property or method as [ScriptableMember] was all that was needed to expose the one member. It was not necessary to mark up the class at all.

    And I would say that Microsoft agrees with me!  ;-)
    http://msdn.microsoft.com/en-us/library/system.windows.browser.scriptabletypeattribute(VS.95).aspx
  • “ScriptableTypeAttribute Class - Indicates that all public properties, methods, and events on a managed type are available to JavaScript code when they are registered by using the RegisterCreateableType method.”

    “If you want to expose only a subset of properties, methods, and events as scriptable endpoints, do not use a ScriptableTypeAttribute object. Instead, attribute the subset of properties, methods, and events with a ScriptableMemberAttribute object.”

    If you do choose to use [ScriptableType] and want to hide one of the public members mark it with:

       [ScriptableMember(EnableCreateableTypes = false)]

    Note: the preferred notation for the attributes excludes the word “Attribute”, so use [ScriptableType] and [ScriptableMember].

     

  • "HtmlAccess=Enabled" is not needed for calls INTO Silverlight, only to enable calls out.
      <asp:Silverlight ID="Xaml1" HtmlAccess=Enabled ...

 

Useful web resources:

SharePoint: Survey Options – Show user names and Allow multiple responses…

 

Trying to find how to change these two Survey list options after you have created the survey?

  • Show user names in survey results?
  • Allow multiple responses?

Based on using other types of lists you would expect to find these in the “Advanced settings” section. For a Survey they put them in “Title, description and navigation”. Go figure…

5/02/2009

SharePoint: With Service Pack 2 (SP2) Forms Based Authentication and Client Integration Works!

 

Forms Based Authentication (FBA) now works with Office Integration! But only for Office 2007 Service Pack 2.

 

Here are my tests:

 

Tests were done on a VPC with SharePoint and Office on the same VPC.

The VPC started with Server 2003 Std Edition, MOSS Enterprise Edition SP1 and Office 2003 Std Edition

Installed WSS SP2 and MOSS SP2

SP2 install instructions: http://fabianwilliams.spaces.live.com/Blog/cns!DC80CE4E9C963237!536.entry

Created a new application, site collection and configured FBA in a typical manner using the ASP.Net membership and role providers.

Client Integration was disabled by default! (in spite of what was said in the MSDN articles.)  In enabled Client Integration for these tests.

Tests with Office 2003

  • Upload Multiple worked!
  • Open in Microsoft Word - did not work, instead it opened login.aspx as a Word document!
  • Export to Spreadsheet – did not work: "To export a list, you must have a Windows SharePoint Services-compatible application"
  • Connect to Outlook – did not work: "error (0x8004110): 'An error occurred either in Outlook or Windows SharePoint Services...."

So, except for Upload Multiple, Client Integration does not work with Office 2003.

Office 2007 (Enterprise Edition) initial release 12.0.6213.1000

  • Open in Microsoft Word - Word launched, but no errors, nothing, just empty word.
  • Open from Word using full URL to document. ("Could not open "http://.....")
  • Connect to Outlook - Displayed normal SharePoint to Outlook messages, but then displayed an emtpy calendar, so the calendar was created in Outlook, but the data was not linked. Clicking on calendar displays the "read only" message usually seen in Outlook 2003.
  • Export to Spreadsheet - "You do not have adequate permissions to modify this list ..."

So, except for Upload Multiple, Client Integration does not work with Office 2007 (without SP2).

 

Office 2007 (Enterprise Edition) SP2

  • It all works! (with one extra click)
  • Open in Microsoft Word – displays a login page (looks just like login.aspx) and after logging in display the document (and saves it) just fine.
  • Connect to Outlook, Export to Excel both fail… but….
  • If you checkmark “Sign me in automatically” while logging in then every thing I have tested so far works.
    • Connect to Outlook works
    • Export to Excel works

So as long as you checkmark “Sign me in automatically” when you login FBA now supports Client Integration!

How does it work?

Cookies. Deleting cookies in the middle of a session will break Client Integration.

If you have written your own custom membership provider or your own custom login page then you will need to implement a “remember me” feature using an ASP cookie.

 

More tests needed…. Does Client Integration work with Office 2007 SP2 without WSS or MOSS SP2???  Don’t know yet…

 

.

4/27/2009

SharePoint: Displaying Pictures and Thumbnails in a Data View Web Part

 

This is in response to a question about displaying a thumbnail from a Picture Library in a Data View web part…

 

Displaying the full size picture is really easy. When selecting your fields for the Data View web part select “Url Path”. This will be added to the XSLT of the Data View web part as:

<img border="0" src="{@FileRef}" alt="{@FileRef}"/>

(@FileRef is the XSLT fieldname used for “Url Path”)

 

The trick is getting the URL to the picture library’s auto-created thumbnail. The thumbnail for “test.jpg” is “/_t/test_jpg.jpg” and is not a field in the SharePoint Designer list of fields. To get it you will need to do some XSLT string work:

concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)

Note: the above will only work if only one “.” exists in the file name. It will fail for a file named my.airshow.picture.jpg

    @FileDirRef is the name of the library (airshow%20pictures)

    @FileLeafRef is the file name (helicopter.jpg)

    @FileType is the file type (jpg)

    ‘/_t/’ is the path to the auto-created thumbnails

  substring-before / after are XSLT string functions

The above “stuff” will convert:

   /airshow%20pictures/helicopter.jpg

into

   /airshow%20pictures/_t/helicopter_jpg.jpg 

which is the path to the thumbnail.

 

The final <IMG> tag looks like this:

<img border="0" src="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}" alt="{@FileRef}"/>

 

If you would like to let the user click on the thumbnail to see the full picture and meta data then wrap the <IMG> in a <A> tag and supply the ID of the picture:

<a href="{concat(@FileDirRef,'/Forms/DispForm.aspx?ID=', @ID)}">
<img border="0" src="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}" alt="{@FileRef}"/>
</a>

SharePoint: Synchronize Document Library Web Part Column Widths

When you add document library web parts to a page, SharePoint automatically sets the width of the columns leaving you with multiple web parts, all with different column widths, and an unstructured look to the page.

Synchronizing the column widths can be done with yet another Content Editor Web Part (CEWP) trick. The trick this time is finding something in common across all of the library web parts on a page, and it turns out that this is the table ID: "onetidDoclibViewTbl0". It looks like this ID is used for Document Libraries and Wiki Libraries.

The JavaScript below will take the column widths from the first web part on the page and then adjust the column widths for all other library web parts on the same page. This should only impact library web parts, and not others such as Tasks or Calendars, but you will need to do some testing!

Steps:

  1. In 2010 create a Notepad file with the 2010 version of the code. Save the file to a local drive and then upload to a SharePoint library in the site. In the library, right-click the file name, click Properties and copy the URL to the file. In the Content Editor Web Part, paste the URL in the Source Link box. Site Actions, Site Settings, Edit Page
  2. Add a Content Editor web part and move it below the library web parts
  3. Click Edit, Modify Shared Web Part
  4. In the Appearance section set the title of the web part to something like “Document Library Column Width Adjuster” so you will know what it is for six months from now.
  5. In the Appearance section find Chrome and select None to hide the title bar
  6. In 2007 click Source Editor and paste the following JavaScript

 

The Code

(this is the 2007 version, scroll down for the 2010 version)

<script type="text/javascript" language="javascript">

function CoordinateColWidths() {

try
{

  //find all document library web parts
  var x = document.all["onetidDoclibViewTbl0"]

  //Get first table's column widths
  var cw = []
  var j
  for (j=0;j<x[0].rows[0].cells.length;j++)
  {
    cw[j] = x[0].rows[0].cells[j].offsetWidth
  }

  //Set all other tables
  var i;
  for (i=1;i<x.length;i++)
  {
    for (j=0;j<cw.length;j++)
    {
      x[i].rows[0].cells[j].width = cw[j]
    }
  }

}
catch(err)
{
  txt="<font size=1>There was an error adjusting column widths.<br/>";
  txt+="Error description: " + err.description + "</font>";
  CoordinateColWidthsErr.innerHTML=txt
}
}

//call only after page fully loaded
_spBodyOnLoadFunctionNames.push("CoordinateColWidths")

</script><span id=CoordinateColWidthsErr></span>

 

Watch outs and warnings!

  • This has not been tested in a production environment – you are on your own! (Please let me know if it works or does not work for you)
  • So far I have only tested this:
    • in IE 6 on a MOSS Enterprise installation, but it should work in WSS.
    • in IE 7, IE 8 and Firefox in SharePoint Server 2010
  • As this uses a hidden web part, remember to document this somewhere so you can recreate the site when needed..
  • Batteries not included, your mileage may vary…

Have fun, and let me know if this works or does not work for you.

 

Code for 2010

<script language="javascript" type="text/javascript">

// SP 2010 version

function CoordinateColWidths() 
{
  try
  {

    //find all document library web parts
    var x = [];
    var tables = document.getElementsByTagName("table");
    for (var i=0; i<tables.length; i++)
    {
      if (tables[i].id=="onetidDoclibViewTbl0")
      {
        x[x.length]=tables[i];
      }
    }

    //Get first table's column widths
    var cw = [];
    var j;
    for (j=0;j<x[0].rows[0].cells.length;j++)
    {
      cw[j] = x[0].rows[0].cells[j].scrollWidth-16;
    }

    //Set all other tables
    var i;
    for (i=1;i<x.length;i++)
    {
      for (j=0;j<cw.length;j++)
      {
        x[i].rows[0].cells[j].width = cw[j];
      }
    }

  }
  catch(err)
  {
    txt="<font size=1>There was an error adjusting column widths.<br/>";
    txt+="Error description: " + err.description + "</font>";
    CoordinateColWidthsErr.innerHTML=txt;
  }
}

//call only after page fully loaded
_spBodyOnLoadFunctionNames.push("CoordinateColWidths");

</script>
<span id="CoordinateColWidthsErr"></span>

 

 

.

4/24/2009

Get on the bus (at MAX!)

Microsoft has a bus! The CAREER EXPRESS BUS, and it's going to TechEd 2009. Each day of the trip, the CAREER EXPRESS will visit Microsoft Learning partners and IT Academies; meet with individuals, organizations, authors, and user group leaders; and hold Microsoft Certified Professional (MCP) and Microsoft Certified Trainer (MCT) meet-ups along the way. On May the 5th the bus is stopping at MAX Technical Training. If you are in the Cincinnati / Dayton area stop in and visit, get a free lunch and maybe win some cool prizes! (there are rumors of an X-Box and a lot of other stuff!)
More info here.
MAX will have various games and activities at the event to win entries into the multiple PRIZE DRAWINGS. For the free food and the prize drawing, you must register: REGISTER HERE How to get in on the drawings: YOU MUST:
  • REGISTER for the event = 1 entry
  • Attend the event = 1 entry
  • Drag another body to the event = 1 entry per additional body (body must be breathing)
  • Student Alumni - if you register and attend you will get 1 additional entry for each class you have already attended at MAX during the 2008 and 2009 calendar years
  • Bring your MCP or MCT identification card = 1 entry
  • Play the various games to earn even more entries
  • DRAWINGS WILL BE AT (approx.) 12:30 MUST BE PRESENT TO WIN

See you there!

Mike

4/01/2009

SharePoint: Adding User Profile when Using Local Accounts

Manually adding Local Accounts to Shared Services Profiles Just a note about odd behaviour when using local accounts with SharePoint... You are most likely to run into this within a test VPC... Shared Services -> User Profile and Properties, View user Profiles: Clicking New Profile displays an edit screen where you can add a manually entered profile. If you complete the form, and then go back and check it you will find that all of the data, except for the Account Name is gone. The trick is to click New Profile, enter the Account Name (as entered in Windows in Local Users and Groups), and click Save. Then edit the profile and add the rest of the data.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.