I am trying to create a link/button on my masterpage which when clicked, adds the current page to the user's My Links list. This is merely a shortcut to save the user from having to navigate to their My Site and add the link manually.
[This blog post] gives a solution to this problem, but I get a JavaScript error on the second line of the "Add Link" dialog (QuickLinksDialog2.aspx) because the frameElement property is null:
<script language="Javascript">
var form = document.forms[0];
var args = window.parent.frameElement.dialogArgs;
Regardless, Portal.js appears to contain all the functions that the My Links page (_layouts/MyQuickLinks.aspx) uses to add links to this list.
Can anyone suggest how I might go about calling one/some of these functions from my masterpage so that the "Add Link" dialog is opened with the title and URL fields pre-poulated?
I ended up using the object model to create the My Links (as apposed to the popup dialog).
The upside to this is that adding a link is now only a 1-click process, the downside is that the user does not have the opportunity to rename the link or assign it to a group (personally, I've hidden the groups from the UI anyway as we didnt need them so this was a non-issue for me).
For those interested, I created a little usercontrol which just houses an ajaxified button which you can drop onto your masterpage / page layout. My code for this is as follows:
HTML
C#