none
How to create Target Audience with a specific GUID - SharePoint 2010

    Question

  • Hi, I use SP 2010.

    I can create target audience in Central Admin, but that assigns them a random GUID. What I need is to create a target audience using a specific GUID.

    I can use Visual Studio solution as needed. Any help on how to create this will be appreciated.

    Thanks in advance.


    • Edited by ran009 Thursday, October 04, 2012 11:48 PM
    Thursday, October 04, 2012 11:47 PM

Answers

  • I figured out how to do this in a somewhat unsupported fashion as I did it through the database directly. I copied the stored procedure that Microsoft uses to create audiences and tweaked it a little. I then used it to create the audiences I needed...based on the values on our production server. Once created, I used the Central Admin to set the rules. This worked flawlessly in SharePoint 2010 with April Cumulative Release. Don't know about other versions but the concept should be the same.

    My only advice is to closely compare the proc I wrote to the original (I forget the name but it had the word ORGLE in it) as its possible it will change in some future update. It was a pretty straightforward proc though.

    I posted the proc here (at the very bottom):

    http://sharepoint.stackexchange.com/questions/47676/set-guid-programatically-for-new-audience

    Hope it helps someone.

    • Marked as answer by ran009 Sunday, October 21, 2012 6:41 PM
    • Unmarked as answer by ran009 Monday, October 22, 2012 10:26 PM
    • Marked as answer by ran009 Wednesday, October 24, 2012 6:42 PM
    Sunday, October 21, 2012 4:30 PM

All replies

  • Hi Ran009,

    I don't think it is possible to set the GUID yourself. It is always generated. As example, it is the same for list instances.


    Cordialement/Regards,

    Ludovic Caffin
    .NET/SharePoint Consultant for A3IS.

    • Marked as answer by Lhan HanModerator Monday, October 15, 2012 2:45 AM
    • Unmarked as answer by ran009 Sunday, October 21, 2012 5:04 PM
    Friday, October 05, 2012 10:09 AM
  • I figured out how to do this in a somewhat unsupported fashion as I did it through the database directly. I copied the stored procedure that Microsoft uses to create audiences and tweaked it a little. I then used it to create the audiences I needed...based on the values on our production server. Once created, I used the Central Admin to set the rules. This worked flawlessly in SharePoint 2010 with April Cumulative Release. Don't know about other versions but the concept should be the same.

    My only advice is to closely compare the proc I wrote to the original (I forget the name but it had the word ORGLE in it) as its possible it will change in some future update. It was a pretty straightforward proc though.

    I posted the proc here (at the very bottom):

    http://sharepoint.stackexchange.com/questions/47676/set-guid-programatically-for-new-audience

    Hope it helps someone.

    • Marked as answer by ran009 Sunday, October 21, 2012 6:41 PM
    • Unmarked as answer by ran009 Monday, October 22, 2012 10:26 PM
    • Marked as answer by ran009 Wednesday, October 24, 2012 6:42 PM
    Sunday, October 21, 2012 4:30 PM