Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

9/07/2008

Making "Post" and "Get" forms from SharePoint’s pages

Recen project we were working on needed some forms to be posted to certain services. Knowing that SharePoint's pages are one big form and you can't nest another form inside another this starts becoming a problem.

But I remembered a while ago I was watching how the guys over at MSN spaces did it with the "Blog this" functionality. So based on this I've made similar script and methodology so you can create "forms" that make POST or GET from within SharePoint's Pages. The script is not fully automated, since it directly works only in IE, but with minor additions specific to your form, you can get it working easily in other browsers also.

Read all about it over at my new blog

.

9/03/2008

Group items in a data view with the ability to nest items

In case you've missed it I've written a new article over at my new blog, which shows step-by-step process to group items. The difference between this method and the method the SharePoint Designer uses is - you can use nested elements (like nested lists, nested divs, etc.), which is fantastic for some navigation items, etc.)

See how to group items a bit differently over at my new blog

Oznake ponudnika Technorati: ,,,

8/26/2008

Test move of my blog + a new post on the new one

I've been trying to move for a while. Still while this service is great, I've decided to migrate my blog to another platform. (No, still not SharePoint - that comes next :)). But now you can find my blog (currently) on a new address:

http://boris.gomiunik.net

I've added lots of stuff to that blog - like the support pages for my ERTE project (which I'll be expanding), code highlighting (at least in some posts and for future posts), etc. And there is also wider space for my screenshots and code snippets.

You don't have to update the RSS, if you're subscribed to FeedBurner, If not, please update your subscribtion to http://feeds.feedburner.com/webborg.

If you check the new site, there is already an interesting post awaiting for you about a different way of sorting and grouping which enables nested items.

Hope this move will work, otherwise we'll meet back here on webBorg :)

8/14/2008

SharePoint Conference in Slovenia

B4Contact, the company where I work, is preparing an event that will take in my home town, Murska Sobota:



Display bigger map
 
Apart of knowing this beautiful part of our planet the event will open opportunities for cooperation between Microsoft partners from Slovenia and neighboring countries as Italy, Croatia, Hungary, Austria and other European countries.
 
It will be also a good opportunity to see which solutions are available for SharePoint!
 
I will have a presentation there, of course, but I will not tell you about it yet.

Here comes another nice part: If you think you could be a speaker, please let me know by adding a comment. I would love to get to know in person some of you!

More details will follow

7/30/2008

Deployment of ERTE

There were some questions about how to deploy the ERTE solution that I've prepared on Codeplex (for inserting embeddable content to SharePoint Enhanced Rich Text Field). So I've prepared a video on how to deploy it.
 


Oznake ponudnika Technorati: ,,,

7/24/2008

Couple of useful JavaScript global variables in SharePoint

If you're using custom JavaScripts with SharePoint some global JavaScript variables may come in handy.

These variables work if you're using SharePoint's default or any other custom master page.

L_Menu_BaseUrl - the base URL of the site / subsite. Very useful when you need to determine the absolute path of the site in JavaScript. Example: document.location = L_Menu_BaseUrl + 'lists/calendar/allitems.aspx' //redirects to Calendar list

L_Menu_LCID - the LCID of the site you're in. Useful if you need to determine the language of the site. The list of Locale IDs can be found here. I'm using the LCID for localizations in ERTE project. See the example of checking LCID below:

.
L_Menu_SiteTheme - the name of the theme applied to the site.

There is one more useful variable, but this one can't be used on custom master pages that you created. This one is used in the SharePoint's default pages:

_spUserId - the ID of the logged in user.

Oznake ponudnika Technorati: ,

7/23/2008

New Release of ERTE for SharePoint now supports localizations.

The new version is released. If you've downloaded the first release, just download the new one from CodePlex and replace the .js file in the /_catalogs/masterpage gallery in your site collection. The project is still under Beta, so if you find some bugs please let me know.


The new version now supports localizations. The current version is published with English (LCID 1033) and Slovene (LCID 1060) translations. If the script can't find localization for your language, it will use english by default.

To add your own localization, add under "//Localization arrays" the translated following line:

var erte1033 = new Array("Please inputtt details","Alt Text","This will be displayed in RSS feeds","Embed Code","Paste your Embed code here","Insert","Close"); //english

and change the LCID and language at the end. If you don't know the LCID of your SharePoint site, open it in Internet Explorer, in the address bar type javascript:alert(L_Menu_LCID) and press enter. The alert window will tell you the LCID. The final translated version (example for Slovene language) will look like this:

var erte1060 = new Array("Vnesite parametre","Besedilo","Besedilo bo izpisano v RSS-viru","Embed koda","Prilepite Embed kodo v polje","Vstavi","Zapri"); //slovene

If you've localized the texts, I'd be happy to add them to the new release, so we could have as full version as possible. Please publish the translation under comments on my CodePlex HomePage.

Oznake ponudnika Technorati: ,,,,,

7/11/2008

Just released: Enhanced Rich Text Field Extended

I was already writing and showing how to embed Flash animations in a SharePoint Blog or any Enhanced Rich Text Field.

Watching MIke Gannotti's video about what I was already presenting he had a good point, the solution is not so user-friendly.

So I changed the methodology a bit. Now the simple-to-deploy solution offers the following features:

1. Embed almost any HTML code snippet
2. Additional button in the Rich Text Toolbar to help you embed

3. A User Interface for pasting the code snippet

No server-side code is included. To see more and download the JavaScript please visit

http://www.codeplex.com/erte

The deployment instructions are on the homepage and in the release zip file.

Oznake ponudnika Technorati: ,,,,

6/27/2008

Where have I disappeared?

It's been a while since I was blogging here. I haven't disappeared from the face of the earth. I've made quite some progress and discoveries, so keep tuned in the future.

Mainly I've been working on some projects..

1. The Biggest one: SharePoint Simple CMS
Enables you to have a beautiful web design over your WSS site and really easy-to-edit contents of websites. Jose has already prepared some videos.

 

Thanks also to Mike Gannotti for a nice review.

2. The other - personal:
Even though he's small... he's quite a big project :)

In the SharePoint I've come up with quite some tricks, so stay tuned.

5/08/2008

Learn SilverLight on Lynda

A quickie: If you want to learn to create SilverLight applications, Lynda has published free video training for it. The whole course is available for free.

Click here to start learning.

Oznake ponudnika Technorati: ,,

4/15/2008

Screencast: Embedding Flash videos in SharePoint Blogs

I was already writing about the problem of SharePoint filtering out the embed code for Flash content and a workaround to this issue.
 

There were some questions in the comments and also maybe the instructions weren't quite clear, so I've made a screencast showing the entire process.
 

Sorry for the bad sound quality. I've had trouble with microphone, so thanks to Audacity I didn't need to record again. Below you can see the video screencast published on YouTube (Strange, MSN Video didn't want to process it). If you want to see the video in better quality (not sound) and with Table of Contents, click here (17 mb streaming flash, 9 minutes).
 

Oznake ponudnika Technorati: ,,,

4/11/2008

Edit your photos online

If you need a quick fix on one of your photos or images, and you don't want to install any additional software on your computer, you can use the online PhotoShop Express. Check Jose's review and links to the solution. It's free and it's very good.

But there is another online service for modifying your pictures that I believe is also very good: It's called Picnik. You can find it on www.picnik.com.

There are some really nice features:

1. You don't have to signup or register to upload and edit picture
2. Lots of basic tools like Auto fix, Rotate, Straighten, Crop, Resize, Fix exposure, Sharpen, Red-eye removal, ...
3. Lots of effects for your photos

4. You can put texts, shapes, frames on the images
5. You can edit curves and color levels (for premium version only)
6. lots and lots of other stuff
7. If you want to experiment with the tool, it has some sample images for you to try the tools
8. It can connect to Flickr, Picasa, FaceBook and other online photo services, or you just upload your photo

Below is a sample that I made in just a couple of minutes using auto fix, exposure fix, rotate-straighten, added shape, text, some radial effect and drop shadow border and resized image:


I recommend you to visit the site and try it yourself.

Oznake ponudnika Technorati: ,,,,

4/07/2008

The quick way to preload images

If you use background images for hover effects with CSS (for example links hover effects) in IE you don't get a nice effect, because the "mouseover" image is always loading, creating a "gap". So it's good to have the "mouseover" images preloaded. There are numerous of ways to preload images, but usually what I'm doing is loading those images in a hidden layer. For example: if you have a css:

a.menu { background: transparent url('menu_off.gif') no-repeat left top }
a.menu:hover { background-image: url('menu_on.gif') }

you'll want to have the images menu_off.gif and menu_on.gif preloaded. The way I'm doing it is by adding to the top of my webpage right after the <body> tag the following code

<div style="display:none; visibility:hidden; position:absolute; left: -3000px;">
  <img src="menu_off.gif"/>
  <img src="menu_on.gif"/>
</div>

This will put the two images loaded in a hidden layer and thus keeping them preloaded. And because this layer is right at the beginning of the page, you'll have the images preloaded first. 

Oznake ponudnika Technorati: ,,

4/04/2008

Add functions and events to SharePoint form fields

Do you sometimes wish to make some special form validation or other javascript actions on SharePoint form fields (like for example onchange, onfocus, onblur, etc?). You can add special functions on events to the SharePoint form fields using JavaScript. All you need to do is

1. Write your JavaScript function
2. Use the getField function I was writing about to refference the SharePoint Fiedl
3. write the following code:

getField('[field_type]','[field_title]').[event] = function() {[function_name]};

Let me demonstrate in an example below. I have a SharePoint List with a field "Menu" that is a lookup field to Title list "Menu". I've created another field "Menu_id" that is a lookup to the same list, but instead of Title it should select the ID. These two fields need to select the same item from the list Menu.

 

Now we'll prepare a one-way synchronization. We'll want those two fields synchronized when selecting the item from the "Menu" dropdown. So we'll add an "onchange" event to the "Menu" select field.

1. Add a Content Editor Web part to the page using this method

2. Edit the Source of the content editor web part add the script code, insert the getField function, write your function and use function above. The full code is below

<script type="text/javascript">
function getField(fieldType,fieldTitle) {
    var docTags = document.getElementsByTagName(fieldType);
    for (var i=0; i < docTags.length; i++) {
        if (docTags[i].title == fieldTitle) {
            return docTags[i]
        }
    }
}

function syncDropDowns() {
selectedId = getField('select','Menu').options[getField('select','Menu').selectedIndex].value;
for (i=0; i<getField('select','Menu_id').options.length; i++) {
  if(getField('select','Menu_id').options[i].value == selectedId) getField('select','Menu_id').options[i].selected='selected';
}
}

getField('select','Menu').onchange = function() {syncDropDowns()};

</script>

This is an example made with CEWP and in the SharePoint. The same works also in the Data View Webpart.

Oznake ponudnika Technorati: ,

3/17/2008

Reordering items in data view

A links list in SharePoint has an interesting functionality - to change the order of items.

I've tried and this functionality can be applied to all the lists and used in a data view. Let's go in order.

To reorder the list go to _layouts/reorder.aspx?list={list_guid} in the same site. If you don't know the list guid, go to list settings and replace listedit.aspx with reorder.aspx. You'll go to the interface to reorder items in that list:

 
The change will not be visible in SharePoint's AllItems.aspx page.
 

To sort items in the data view according to ordering you just made:

With data view inserted to the page the first thing we need to do is add the order field to the data view fields. To do this click the list name in the task pane Data Source Details
 

Next click button Fields, find and select Order in the left column and click Add.
 

Click OK to confirm the changes and close the Data Source Properties dialog by clicking OK again. Now you select data view Sorting (in Common Data View Tasks select Sort and Group) and you can choose Order. If you can't find Order in the dialog box, click the last option (Add Sort Expression) and click Add.
 

In the next dialog box, you can select Order from the fields.
 

Now confirm all the selections by clicking OK to close all dialog boxes.

That's not all. Now it's sorted according to order number, but the XSLT is taking this like a text. So we have to fix this. In source code, find <xsl:sort select="@Order" and add a data-type="number" parameter to it.
 

That's it. Now you have items sorted according to the ordering you've made.

What I usually like to add to the data view is a link to reorder items. Just add a footer and in the footer add a hyperlink to the reorder page (the one mentioned at the beginning).

Oznake ponudnika Technorati: ,,

3/11/2008

Are you a web designer? Want to get sponsored?

I'm happy to announce that in our company we're making effort to contribute to open source and design community. We're looking to sponsor web designs that will be free to use.

If you are interested, you can find more information on Web Designers Sharing Point.

There are already some members in the community, the latest one is Andreas Viklund.

As the result there are already two templates available free to download:

1.Internet Studio

Download - Check sample

2. Small Corporation
 
Download - Check sample

There will be more to come. If you wish to participate and get sponsored, please visit the blog and contact Jose.

Oznake ponudnika Technorati: ,,

3/08/2008

SharePoint site and multiple domains - alternate access mappings is the way

This is an update to one of my older posts - SharePoint 3 is bound to host headers - I was explaining the problem how the SharePoint binds itself to one host header and a simple trick to avoid this. There is a better way to add another host header to the web application:

On the Server in SharePoint 3.0 Central Administration select Operations tab and select Alternate Access Mappings under Global Configuration.
 

 
Now change the web application you want to edit public URLs for by using the dropdown on the right hand of the page
 

Next click Edit Public URLs
 

And now enter full URLs (including http:// or https://. You can add up to 5 URLs to which the web application will respond


 

At the end also add the host headers to the Website in the Internet Information Services manager.

Note that this works on the web application level. If you have site collections with custom URLs you can't configure multiple URLs for each of these (or if someone know the way, I'd appreciate if you left me a comment).

Oznake ponudnika Technorati: ,

3/05/2008

Great site with a lot of free tools

It's useless to talk and search out all the good free software, when this guy is making an amazing job. Almost daily you can find here new and useful freeware tools. I found it by coincidence, but it's absolutely worth linking to it.

Visit Freeware Genius

Don't miss also the site's featured article: Reinstall Windows and outfit your system with all Freeware programs.

Oznake ponudnika Technorati: ,

3/04/2008

Navigating through SharePoint Site using URL

I like to access lists, document libraries directly instead of visiting site or subsite and then clicking my way around. SharePoint has very logically structured URLs. Here are some of the most common:

To access: Type url http://[URL]+
Lists /lists/[List name]*
List New Item form [list URL] + NewForm.aspx
List item details (display) [list URL] + DispForm.aspx?ID=[item ID]
List item edit [list URL] + EditForm.aspx?ID=[item ID]
Document Libraries /[Document Library Name]*
Document library upload [DocLib url] + /Forms/Upload.aspx
Document library item details [DocLib url] + /Forms/DispForm.aspx?ID=[item ID]
Document library item edit properties [DocLib url] + /Forms/EditForm.aspx?ID=[item ID]
Special SharePoint pages http://[URL]+/_layouts+
View all site content viewlsts.aspx
Recycle Bin... recyclebin.aspx
Site Collection's recycle bin adminrecyclebin.aspx
Create create.aspx
Site Settings settings.aspx
New Subweb newsbweb.aspx

* in cases of Lists and document libraries only spaces get preserved (and translated in %20 in url). Special characters are excluded (for example: list Special ÄŒheck url would be http://[sute url]/lists/Special%20heck/

These things are quite obvious. What I'm trying to point out is if you're accessing certain lists/document libraries/settings often, it's not a bad idea to start paying attention to URLs.
Oznake ponudnika Technorati:

3/03/2008

How SharePoint stores field names

In my one of my previous posts I've received a good comment from Mike that got me talking quite a lot about SharePoint List / Document Library Field Names. So it's better to dedicate a post to it. First I'll explain some exceptions and then show how to quickly get a sharepoint field name.

You can't change SharePoint field name

Once you create a field, you can't change the "SharePoint" name for it. Im using this sometimes when creating lists. I'll create a field called FirstName and then rename it to First Name. Like that I have no complications with spaces or any unstandard characters. So now (compared to previous post) I can filter with FilterField1=FirstName. 

 

Title field

No matter which list you create (except survey), there will always be one Title field no matter how we have it named. We can recognize this title field as the one that is linked to the item (with edit menu)

No matter what you rename this field to, this field will always be "SharePoint" named Title.

Field names for Out-of-the-box lists

Lists that are already included in the templates (like for example Contacts) have different "SharePoint" names than "Display" names. For example: In a Contacts list we can see a field called Fax Number, but "SharePoint" name for it is WorkFax. How to discover real names? Skip to the end of this post and read more.

Spaces and special characters in field names

Spaces in field names get converted to _x0020_. 0020 represents the Unicode character code. If you'd like to know any other, I've found this very good web character convertion tool. Just enter character into Characters field and you'll find the code in Hexadecimal code points but make it a 4 digit number (for example 20 for space should be 0020).

When using those special characters in URL, the underscore (_) gets converted to %5F

So how the heck to know SharePoint field names?

You COULD mess around with all the specialities and translations and conversions that I've mentioned untill now, but there's an easier way:(two actually):

1. Sort the List / Document Library and check in URL for SortField parameter value.
 


2. Go to List / Document Library Settings, click on the name of the column to modify it and in URL find the last parameter value
 

 

And ofcourse if you need to use the field name in other places than URL (like in SharePoint designer), don't forget to convert %5F to underscore.

P.S. - Yes, I know there is also a way to see SharePoint Field Names in SharePoint Designer (mouseover a field name in Data Source Details), but in this post I wanted to focus on work without it.

Oznake ponudnika Technorati:

2/29/2008

Sort a List / Document Library view using URL

This one's an add-on to the previous post. Even though it's quite quick to sort items in a List / Document Library view by clicking on the column title, you can do this also by using URL. Just add parameters

?SortField=[Field Name]&SortDir=[Asc / Desc]

Example: to sort by Title descending, type ?SortField=Title&SortDir=Desc

When is it more worth to use URL instead of clicking? When you...

... like typing urls :)
... need to use this in a script
... need to make direct links manually
... don't want to create an extra view just for sorting

Oznake ponudnika Technorati:

2/27/2008

Quickly filter a List/Document Library View using URL

This one's very useful when you're having a lot of items in a list or document library and you need a quick filter.

If you'll select the filter field it can happen that it will load for a long time. So lately I'm using URL. Suppose you have a long list of contacts and you need to find a contact named Boris.

In the AllItems.aspx - view of the page, add parameters

?FilterField1=[Field Name]&FilterValue1=[Value]

You can add more filterfield and filtervalue parameters to apply filters to more fields (FilterField2, FilterValue2, ...)

The only trick is to know the Field Name like it's saved in SharePoint. You can see this in the list settings page (click on a column name and check URL) or just make a manual filter for the first time.

In my case to find a contact with First Name Boris, I'd go to

http://[site_URL]/lists/contacts/AllItems.aspx?FilterField1=FirstName&FilterValue1=Boris

I'm always browsing a document library with filtering by specific document type. So I've created a simple script. Just add a Content Editor Webpart to your homepage, edit its source and add the following code (just update the url to your document library (docLibUrl):

<script type="text/javascript">
function docLib(dropdown) {
  var vtype = dropdown.options[dropdown.selectedIndex].value;
  var docLibUrl = "/Shared Documents/Forms/AllItems.aspx";
  var filterField = "DocIcon"
  if (vtype != 'Select') {
    document.location=docLibUrl+"?FilterField1="+filterField+"&FilterValue1="+vtype;
  }
}
</script>
<select style="margin:10px; 0px;" id="DocumentTypes" onchange="docLib(this)">
<option value="Select">Select document type</option>
<option value="Select">-- Office 2007 --</option>
<option value="docx">Word 2007</option>
<option value="xlsx">Excel 2007</option>
<option value="pptx">PowerPoint 2007</option>
<option value="Select">-- Office 2003 --</option>
<option value="doc">Word 2003</option>
<option value="xls">Excel 2003</option>
<option value="ppt">PowerPoint 2003</option>
<option value="Select">-- Other --</option>
<option value="pdf">Acrobat (PDF)</option>
</select>

Oznake ponudnika Technorati: ,

2/26/2008

Adding Flash animation in SharePoint Blog and other lists pt. 2

This post continues the topic from my first part about embedding Flash videos in SharePoint Blogs where we've learned how to embed one Flash animation or video (or have a lot of work for publishing each flash).  The problem arises if we want to embed more videos and have them displayed automatically.

Since SharePoint is very strict about filtering a LOT of the code out, I've devised a way of passing all the parameters needed for swf object through ID. And how to recognize divs for the swfobject? Using CSS class name.

Here's what we need to do:

1. Have te swfobject.js uploaded to the site.

2. Add the following javascript at the end of the page (or in a Content editor webpart below the posts or list items:

<script type="text/javascript" src="swfobject.js"></script>

<script type="text/javascript">

function embedFlashes() {
    var myLayers = document.getElementsByTagName('div');
    if (myLayers.length>0) {
        var myFlashes = new Array()
        for (i=1; i<myLayers.length; i++) {
            if (myLayers[i].className == 'flashcontent') {
                myFlashes.push(myLayers[i].id)
            }
        }
        var so = new Array()
        for (j=0; j<myFlashes.length; j++) {
            tempParam = myFlashes[j].split('::')
            so[j] = new SWFObject(tempParam[0], tempParam[1], tempParam[2], tempParam[3], tempParam[4], tempParam[5]);
            for (p=6; p<tempParam.length; p++) {
                detail = tempParam[p].split('=')
                so[j].addVariable(detail[0], detail[1])
            }
            so[j].write(myFlashes[j])
        }
    }
}

embedFlashes()
</script>

3. Now in the content you need to edit the HTML code of the body and insert the layers in the following format (note - input parameters are separated by double colon.:

<div class="flashcontent" id="[url_of_swf_file]::[unique_id]::[width]::[height]::[minimum_flash_version]::[background_color]::[flashvar1=flashvar1_value]::[flashvar2=flashvar2_value]...">[Alternate_content]</div>

Let's reuse the sample from previous post and some color coding. To embed

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Z2yNzw00mpA&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Z2yNzw00mpA&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

Insert the following html to the blog post body:

<div class="flashcontent" id="http://www.youtube.com/v/Z2yNzw00mpA&rel=1::video01::425::355::8::#FFFFFF">Please view this post on my website to display the video.</div>

The rest of parameters are made up - video ID is video1, it requires flash 8 and background color is #FFFFFF - white. Let's do another sample with flashvars - the same video on MSN Video. The Embed code is:

<embed

src="http://images.video.msn.com/flash/soapbox1_1.swf" quality="high" width="432" height="364" base="http://images.video.msn.com" type="application/x-shockwave-flash"
allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&v=d41e1dfd-919b-4d57-89c9-736f9c75db14&ifs=true&fr=msnvideo&mkt=en-US&brand="></embed>

To embed this video you'd use the following HTML code:
 

<div class="flashcontent" id="http://images.video.msn.com/flash/soapbox1_1.swf::MSNVideo01::432::364::8::#FFFFFF::c=v::v=d41e1dfd-919b-4d57-89c9-736f9c75db14::ifs=true::fr=msnvideo::mkt=en-US::brand=">Please view this post on my website to display the video.</div>

And the result:

 

Yeee, working!

Technorati tags: SharePoint JavaScript Flash SharePoint Blog

Adding Flash animation in SharePoint Blog and other lists pt. 1

UPDATE: This is an outdated method. There is a much easier way. See ERTE on Codeplex or ERTE on my new blog.


SharePoint's rich text field is much better than in version 2.0. It even enables to edit the HTML source. But one thing I don't understand is why it filters out the HTML code so much that we can't even embed the Flash animations or videos into the content. This is a major drawback for SharePoint Blog.

Fortunately I've come up with a nearest thing to a remedy. It's using Deconcept SWF object. It will replace an "alternative" content in a layer with a flash animation (this is also a good way to bypass the "Click to activete this control..." issue in IE). 

Let's say we have a blog and a video to embed for example - this one from YouTube. A simple way of doing it - if you have only one video in the page is:

1. Create a document library and upload the swfobject.js (downloaded from author's website) to it (or just upload it to the root of your website with SharePoint Designer).

 

2. Add a blog post and in the body edit the HTML code and insert the following code:

<div id="flashcontent">Please check this post on my website to view the video</div>

3. In the blog homepage and in the post details page (post.aspx), add a Content editor webpart and edit the source. Enter the following code:

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
    var so = new SWFObject("http://www.youtube.com/v/Z2yNzw00mpA&rel=1", "mymovie", "425", "355", "8", "#FFFFFF");
    so.write("flashcontent");
</script>

For comparison I'm pasting also the YouTube's embed code and I'm color coding it to match the script:

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Z2yNzw00mpA&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Z2yNzw00mpA&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>


For more details on the script and how to add flashvars. Just be sure to have the right path to swfobject.js and to have the right ID of the div and in the script (in the case above: "flashcontent".

This is the result:

 

Unfortunately in the RSS is still showing the alternate content.

 

This is the method of adding only one video per page. You'd need multiple div ids and you't always need to add to the script below. Fortunately I've prepared a way of automating this. More about this... Stay tuned for my next post.

Technorati tags: SharePoint JavaScript Flash SharePoint Blog

2/25/2008

Adding webparts to other SharePoint pages than homepage and webpart page

Recently I wanted to add some text descriptions to the "NewForm.aspx" and "EditForm.aspx". I remembered a trick Pedro Serrano showed me some time ago. It works for SharePoint 2.0 and SharePoint 3.0.

All you need to add to the page are the
 
?PageView=Shared&ToolPaneView=2
 
parameters.

This opens the Task pane for adding webparts. So now you can add any webpart to the page. Some practical uses are to add Content Editor Webparts to the page or related lists,...

Oznake ponudnika Technorati:

2/21/2008

Free Undelete utilities

Not long ago I've had a bit of mishap by deleting some of my very important pictures (birth of my kid). With the first shock I couldn't find quickly any free software for undeleting.

After calming down I've found the following two:

Office Recovery FreeUndelete 2.0

Free Undelete +

They did a very good job and I have my photos back :) I hope by posting these here they'll help someone else too. I'd be glad to hear about similar situations or software in the comments of this post.

Refferencing Hours and Minutes dropdown on "Date and Time" field with JavaScript

I've already posted on how to refference SharePoint field with JavaScript (here - with functio getField).

For "Date and Time" type of fields you can use the above function only to refference the Date part. Thanks to Erik / Tanker who commented my post and discovered that these dropdowns get the same ID but just have added "Hours" or "Minutes" to it I'm posting now the 2 more functions to refference Hours and Minutes with these kind of fields.

There are numerous options - you can merge all together in one function, you can make separate functions, etc. I've decided to make two additional functions:

1. You'll need the getField function I've already posted

2. Add the two following functions:

function getDateFieldHours(fieldTitle) {
    var dateField = getField('input',fieldTitle)
    return document.getElementById(dateField.id+'Hours')
}

function getDateFieldMinutes(fieldTitle) {
    var dateField = getField('input',fieldTitle)
    return document.getElementById(dateField.id+'Minutes')
}

So if you have for example "Start Time" field which is Date and Time you can refference:
- the Date part with getField('input','Start Time')
- the Hours part with getDateFieldHours('Start Time')
- the Minutes part with getDateFieldMinutes('Start Time')

Thanks again, Erik!

Oznake ponudnika Technorati: ,

1/23/2008

"Cannot find c:\...\exportsettings.xml" error when restoring with SharePoint Designer

When making a SharePoint Designer backup of a certain Windows SharePoint Services site it's creating it normally. But when you try to restore the same backup you receive the cannot find ... exportsettings.xml error. After digging a lot around I've discovered that this is actually a SharePoint Designer Bug.

This error occurs if your backup has more than 25 MB. So to move larger sites we're in trouble and we should wait for SharePoint Designer team to fix the bug? Yes. Meanwhile there is a workaround that worked for me. Suppose we want to copy the SharePoint site http://www.mysite1.com/ to http://www.mysite2.com.

We need the following:

1. Access to the server where the SharePoint mysite1 is hosted
2. SharePoint designer (you don't need it installed on the server)
3. Administrative rights to mysite2.com

And the process is as follows:

1. On the server where you have the www.mysite1.com locate the file stsadm.exe (usually in the folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN). Copy the stsadm.exe to a location where you'll run it or make %path% to it or go to that folder in the command prompt.

2. Open the command prompt with the location of the file and type the following command (let's say we'll backup to c:\.

stsadm -o export -url http://www.mysite1.com -filename c:\mysite1.cmp -cabsize 1024 -includeusersecurity

This is the EXPORT backup of the site with some additional parameters:
-cabsize 1024 makes the backup file size 1024 megabytes instead of standard 25 (which is the error limit in SPD)
- includeusersecurity remembers the security settings of the sites

3. Copy the c:\mysite1.cmp file to your local computer or where you have the SharePoint Designer installed.

4. You have to have the site collection (or subsite) with deployed Blank site template on address www.mysite2.com. Open the site www.mysite2.com with SharePoint Designer and make a SharePoint Designer restore (how? Read more here)

That should have it working.

Backup, restore and migration of sites on SharePoint 3 pt. 3/3

stsadm -o export and stsadm -o import

To backup:
1. Locate stsadm.exe
2. in Command prompt type stsadm -o export -url http://[url-of-the-web-site-or-subsite] -filename [path and name of the file.dat]

To restore:
1. Create a web application and a site collection using sharepoint central administration. Or you can create a subweb in an existing site collection. In both cases you should use a "Blank site" template.
2. Locate stsadm.exe
3. In Command prompt type stsadm -o import -url http://[url-of-the-web-site-or-subsite] -filename [path and name of the file.dat]

You've probably noticed a difference from a method described n previous post is small (only export and import instead of backup and restore). Also we can see that the order of parameters and their values isn't important.

PROS:
1. You can export (migrate) a subsite
2. If you include parameter -includeusersecurity it keeps the security settings and owner information
3. It doesn't keep the list and sites GUIDs so you can use it to copy a site collection inside of the same content database.

CONS:
1. You need access to the server to run the stsadm.exe
2. It doesn't keep the SharePoint Designer's Data-View-Webparts (again you have to fix them manually - read more about it here.)
3. You loose the meta data (created and modified dates and who created it) by default.

1/21/2008

Backup, restore and migration of sites on SharePoint 3 pt. 2/3

stsadm -o backup and stsadm -o restore

To backup:
  1. On the server locate the file stsadm.exe (if you have sharepoint 2 and sharepoint 3 locate the one in the "12" folder.
  2. Open command prompt and type [path to stsadm.exe\]stsadm -o backup -url http://[url-of-the-web-site] -filename [path and name of the file.dat]

To restore: 
  1. Create a web application (but don't create a site collection)
  2. On the server locate stsadm.exe
  3. Open command prompt and type [path to stsadm.exe\]stsadm -o restore -filename [path and name of the file.dat] -url http://[url-of-the-web-site]

PROS:

It migrates the whole site collection perfectly! All data-view-webparts are preserved, all user rights, meta data, etc. are preserved).

CONS:
1, It keeps the same GUIDS of lists and sites, so you can't use it to create a copy of the site in the same content database. (Example: You have 1 web application and you want to create a copy of the site in the same site collection in the same web application)
2. You can't backup specific subsites - only entire site collection
3. You need to have access to the server to run stsadm.exe

Backup, restore and migration of sites on SharePoint 3 pt. 1/3

SharePoint Designer Backup and Restore

To backup:
  1. Open the site with SharePoint Designer
  2. Select Menu "Site" --> "Administration" --> Backup web site
  3. You can select to backup also the subsites
  4. Select where to save the backup file and write file name

To restore:
  1. You have to have the created blank site (in the same language)
  2. Open the blank site with SharePoint Designer
  3. Select Menu "Site" --> "Administration" --> "Restore web site"
  4. Browse the file from your local computer
  5. After backup is made you can delete SharePoint's temp file on site

PROS:
1. Easy backup, keeps meta data (like "Created" and "Modified" dates, "Created by" and "Modified by") - Even if restoring to different sites. Can migrate between different sub-versions of same WSS 3.
2. You don't need access to the server, just administrative rights on the site.

CONS:
1. A BIG con is that you can make a backup of the sites that have under 25 MB. Looks like this is a bug in SharePoint designer and I hope it will be fixed soon. If you are backing up a site with over 25 MB you will encounter a problem "Cannot find ..... exportsettings.xml". There is a workaround to this (I'll post that in one of my later posts).
2. It doesn't keep any custom data-views created with SharePoint Designer. After you restore and if you have any data-view-web-parts that you've created with SPD and are not working - you have to fix them. Read how to fix them here.