Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to put a link to the "Connect to Outlook" script on a SharePoint 2010 page. I have built the stssync:// URL that triggers the Outlook sync: stssync://sts/?ver=1.1&type=discussions&cmd=add-folder&base-url=[MyServer]&list-url=[MyList]&guid=[MyGUID]&site-name=[MySiteName]&list-name=[MyListName]

Now the link works fine when pasted in IE address bar. However, I can't add it to a Sharepoint page - if I try to use the "insert hyperlink" button Sharepoint will complain about the stssynch:// protocol "URL must be in the form of http://" (or something to that effect).

I have tried to add a regular link that change the URL by editing the page's HTML. However, Sharepoint removes the link on saving the page.

How can I add the stssync:// link to a page? Is there any simple way to somehow "wrap" it in http or something?

share|improve this question
    
btw, you know how to do the same with a new content type item dialog form (in a docLib). i'm using this javascript... javascript:EditItem2(event,"/_layouts/listform.aspx?ListId={YOUR_LIST_ID}&RootFo‌​lder=YOUR_ROOT_FOLDER&ContentTypeId=ITEM_CONTENTTYPE_ID"); ...but with no success! –  fallout Jun 9 '11 at 10:33
    
I tried to insert that link via SharePoint designer, but the link will be removed when saving the site ("Content in embedded form field may be changed by server to remove unsafe content"). I also tried to call a simple js file that will open the link, but I get the same error. –  AlexPoint Jun 9 '11 at 13:52
    
@AlexPoint Thanks for your edit! It's true that this only applies to 2010 now, but we don't know for the next version. So I kept the version in the text but removed the version specific tag. Please see How do I user tags on our meta for more info. –  Alex Angas Jun 16 '11 at 7:48

5 Answers 5

I don't believe you will have a way to change this behavior without modifying core files.

Have you looked into custom field types? This allows you to build in custom validation and allow alternate protocols.

http://msdn.microsoft.com/en-us/library/ms446361.aspx.

You could get creative and try to do some redirects, possibly some type of type of custom shorting / translation service that will take an HTTP link and change it to STSSYN. It would essentially be external to SharePoint.

share|improve this answer

In 2010 there are 2 options. The easiest solution is to wrap the link in a Content Editor web part. To do so:

  1. Browse to the SharePoint page in the browser
  2. Click on Edit on the Page ribbon
  3. From the Insert ribbon select More Web Parts
  4. Select Content Editor and click Add
  5. Edit the new Content Editor web part
  6. Under the Content Editor label, click on "Click here to add content"
  7. Ensure the cursor is within the Content Editor web part and switch to the Format Text ribbon
  8. Under Markup, click the HTML button and Edit HTML source
  9. Add the link to the HTML and click OK. The STSSYNC link should be the href property.
  10. Click OK again and save the page. The link is now active and users can click on it to attach to the list.

I hope this helps, please let me know if there are any missing steps. Cheers!

share|improve this answer
    
Thank you for your reply and sorry about the confusion: We need a solution for SharePoint 2010. I will update the question. If you have a solution that works in SP2010, I'd be happy to award you the bounty! –  AlexPoint Jun 16 '11 at 7:38
    
@AlexPoint Updated with steps. Let me know how it goes. –  Carsten Winsnes Jun 16 '11 at 14:42
    
Thank you for your answer. These steps however do not work as desired. After I paste in the STSSYNC link, a massage is displayed that says "The HTML source you have entered might have been modified". When I click "Save & Close" the link is converted into plain text. –  AlexPoint Jun 20 '11 at 8:00
    
Did you type in your link like this: <a href="stssync://sts/?ver=1.1&type=discussions&cmd=add-folder&base-url=[MyServer]‌​&list-url=[MyList]&guid=[MyGUID]&site-name=[MySiteName]&list-name=[MyListName]">L‌​ink to Outlook</a> That should work, but if not try the answer I'm posting to use jQuery to change the link when the page loads. –  Laurie Jun 20 '11 at 15:29
    
@Laurie: Yes, I tried that but the link has been converted into plain text. –  AlexPoint Jun 21 '11 at 7:31

You can add the following code to a Content Editor webpart or directly onto the page. After adding the CEWP, in the ribbon use Editing Tools > Format Text > Edit HTML source.

<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script language="javascript" type="text/javascript">
  function replaceURL() {
    $('#outlookLink').attr('href','stssync://sts/?ver=1.1&type=discussions&cmd=add-folder&base-url=[MyServer]&list-url=[MyList]&guid=[MyGUID]&site-name=[MySiteName]&list-name=[MyListName]');
  }

  _spBodyOnLoadFunctionNames.push("replaceURL");
</script>
<a id="outlookLink" href="#">Link to Outlook</a>

Here's what it is doing:

  1. Includes a reference to the jQuery library, which you can either do as in this example or you can download it to your site and include a reference to that location on your site instead.

  2. replaceURL() uses the jQuery .attr() method to change the href attribute of the anchor tag with the url that you want.

  3. _spBodyOnLoadFunctionNames.push() will call your function as soon as the page loads.

  4. Your link should have an id which you refer to in your function. The href can be anything, since it gets modified by your function as soon as the page loads.

NOTE: You could use straight javascript instead of jQuery, but the syntax is more complicated.

share|improve this answer
    
This one works for me. Thank you very much, Laurie! –  AlexPoint Jun 21 '11 at 7:32
    
You can find further info on stssync protocol here: msdn.microsoft.com/en-us/library/dd587524(v=office.11).aspx –  frbry Sep 28 '11 at 16:15

This goes along with Carsten's Content Editor answer.

For SP2010 if you want your HTML to remain untouched by SP put it it into a text file that resides somewhere on your site (like in the Site Assets folder). Then in the webpart options of the Content Editor just reference your file (/siteassets/myhtml.txt). SP won't rewrite the code, it will just use whatever is in the file.

share|improve this answer

So you may not be looking for this, but I did for hours and didn't find it so I had to figure it out. To embed a link to connect outlook to a "Group Calendar" you can use JQuery SPServices (located here: http://spservices.codeplex.com/downloads/get/786994 )

Place the below in a CEWP:

<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="http://.../Scripts/js/jquery.SPServices-2014.01.min.js"></script>
<script language="javascript" type="text/javascript">

var Username = $().SPServices.SPGetCurrentUser({
    fieldName: "Title",
    debug: false
});

var UserID = $().SPServices.SPGetCurrentUser({
    fieldName: "ID",
    debug: false
});

document.write('<a href="stssync://sts/?ver=1.1&type=calendar&cmd=add-folder&base-url=[Site URL]&list-url=%2FLists%2F[List Name]%2F&guid=[List GUID]&user-id=' + UserID 
+'&site-name=[Site Name]&list-name=' + Username +'">Click Here</a> to sync up with our Group Calendar now.');
</script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.