The Gods of the sharepoint object model laugh loudly when they see you type this code:
SPListItem link = links.Items.Add();link["URL"] =
So, what's wrong with it? Very hard to spot this one. Upon inspection of working hyperlink fields thathave been added through the web interface, it's easy to miss that there should be a space after the comma separating the url and the display text:
// there is now a space between '...{1}/,' and '{0}'link["URL"] = string.Format("http://www.domain.com/sites/sitename/{1}/, {0}", subsite, linkText);
// there is now a space between '...{1}/,' and '{0}'
Hilarious, not. Scratch up another three hours on "cannot complete this action."
Page rendered at Friday, November 21, 2008 4:14:05 PM (Eastern Standard Time, UTC-05:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.