I'm trying to create a custom SiteUrls provider, but am having no luck. I keep getting the error:
Constructor on type 'SPUrls.SiteUrlsProvider' not found.
1) I Created a Class in a seperate project.
namespace SPUrls{ class SiteUrlsProvider : SiteUrls { private CommunityServer.Urls.UrlsData urlData = null; private ArrayList _links; public SiteUrlsProvider(CommunityServer.Urls.UrlsData data, ArrayList links) : base(data, links) { urlData = data; _links = links; }
//Overrides go here
}
2) I Compiled, added .dll to bin and added this to communityserver.config
<add name = "SiteUrlsProvider" type = "SPUrls.SiteUrlsProvider, SPUrls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
Any ideas?
Have you tried making your SiteUrlsProvider a public class?
namespace SPUrls{ public class SiteUrlsProvider : SiteUrls { private CommunityServer.Urls.UrlsData urlData = null; private ArrayList _links; public SiteUrlsProvider(CommunityServer.Urls.UrlsData data, ArrayList links) : base(data, links) { urlData = data; _links = links; }
CS Documentation - now available in downloadable PDF form
My CS Site
Yeah, I took it out after viewing Wyatts sample post here - I'll put it back and recompile, see if it makes a difference.
...Oh well still no luck, any other ideas? Do I have to take out the SiteUrlsDataProvider node from the communityserver.config?
Ben or Wyatt any input on this?
I know this is a really old thread, but I struggled with this same problem all day today before I figured it out. The postings on the site are a bit outdated . . . for CS2008, if you want to override SiteUrls to create a custom provider, you're class has to look like:
public class CustomSiteUrlsProvider : CommunityServer.Components.SiteUrls {
{
public CustomSiteUrlsProvider(object data) : base((CommunityServer.Urls.UrlsData)data, null) { }
Watch the constructor . . .it's not at all what you'd think it would be (if you simply inherit from SiteUrls). I'm thinking that you might want to update the line of code in SiteUrls.Instance() so that the signatures on SiteUrls and a custom siteUrlsProvider match.
-Matt
Matt,
I tried the code you provided. Still no luck.
I still get the error: Constructor on type 'CustomSiteUrlsProvider' not found.
I'm thinking that you might want to update the line of code in SiteUrls.Instance() so that the signatures on SiteUrls and a custom siteUrlsProvider match.
Can you explain what you mean by this?
Sorry, the "you" in that sentence is more than a little vauge. I meant that the CS development team might want to make the signatures match.
Here's a class that I have working in production. Sorry about the formating.
public class CustomSiteUrlsProvider : CommunityServer.Components.SiteUrls
public override string UserProfile(int userID) { CommunityServer.Components.
CommunityServer.Components.
User Usr; Usr = CommunityServer.
Usr = CommunityServer.
Users.GetUser(userID, false);
return "http://" + Usr.Username + ".PrivateURL.com"; }
public override string UserProfile(string username) {
return "http://" + username + ".PrivateUrl.com";
} }
I figured you may have meant the CS team.
Hmm, I'll try it again. What syntax do you have for this in the CommunityServer.config?
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com