internal SiteID

Vote:
 

Hello,

How do I get the internal siteID for the current site? I'm refering to the table [tblEPiServerCommonSite].

#55278
Nov 24, 2011 15:23
Vote:
 

The ISite interface and its Site implementation has an ID property which will give you the numeric ID of the site. I know you ask about the database table and not the object model, but I don't know those details by heart. Why do you need to dig around in the database for it?

P.S. The Common tables belong to the Common/Community framework rather than CMS, so this isn't really the right forum but I don't think it matters

#55279
Nov 24, 2011 19:51
Vote:
 

Hi,

The reason is that I have a stored procedure that retrieves mailsubscribers from certain site and I need to pass the internal site id for this reason. I dont know any other way to retrieve the mailsubscribers for a certain site. Any suggestions?

#55338
Nov 29, 2011 10:41
Vote:
 

It's not the recipients but rather the recipient containers that are associated with a site. The IRecipientSource.GetRecipientContainers takes an Isite as an argument to filter by site. That way you get only lists (and thereby recipients) connected to that site.

How the site is tied to the container depends entierly on the IRecipientSource implementation. If you use only the EPiServer.Mail.Sources.Internal than that uses some database tables in the "core" EPiServer Mail database. The GetRecipientContainers method uses the sproc spEPiServerMailGetRecipientContainers so you could probably look at that for inspiration on how to find containers vs site ID:s and then spEPiServerMailGetRecipientsByContainer for recipient vs container ID:s.

But I still wouldn't recommend using direct database calls unless you absolutely have to, it's not supported.

#55340
Nov 29, 2011 11:19
Vote:
 

As I can see from the sp's is that you have to pass the internal site ID "@intSiteID" and I cant find anywhere how to get it from my site. The examples that I have studied shows that you need to pass the internal site ID. The other way round works, e.g if you want to retrieve all container for all sites then u get the siteids, but i just want to find a "connection" between the PageReference.StartPage.ID and internal site id.

At first I thought PageReference.StartPage.ID was the same as siteid but apparently this was not the case. 

 

#55344
Nov 29, 2011 11:34
Vote:
 

The Site ID has nothing to do with a page ID. A site is the "Section" that you can create in the EPiServer Mail UI. "int" in the sproc is just hungarian notation for the type of the site ID. Perhaps you can see the site ID in some URL etc in the Secion management.

#55345
Nov 29, 2011 11:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.