i need to develop some sharepoint search alert related werb part and would be grateful if anyone who has previous knowlenge in this area share code snippets or sights where i am guided.

Thank you.

1 Answer 1


Code for creating alerts: User's Alerts always null

I would then go check out:






With the MS structure in mind you should be able to create some example alerts in the gui then fish out their properties with powershell:

    PS H:\> $w = get-spweb http://mysites.NotReally.com
    PS H:\> $w = get-spweb http://mysites.NotReally.com/sites/ghangas
    PS H:\> $w.alerts | ? {$_.AlertTemplateName -like "oss*"}

    Title             : Search: tasks
    AlertTemplateName : OSS.Search
    AlertTemplate     : SPAlertTemplate Name=OSS.Search
    Filter            :
    Properties        : {p_query, eventtypeindex, p_lastnotificationtime, filterindex...}
    ID                : 7d49e2a8-0164-4880-9bd1-84a726558c5f
    ListID            :
    MatchId           : 00000000-0000-0000-0000-000000000000
    ItemID            :
    ListUrl           :
    List              :
    Item              :
    AlwaysNotify      : True
    DeliveryChannels  : Email
    AlertType         : Custom
    EventType         : Add
    EventTypeBitmask  : 1
    AlertFrequency    : Daily
    AlertTime         : 10/19/2012 11:00:00 AM
    Status            : On
    User              : ghangas
    UserId            : 1
    DynamicRecipient  :

    PS H:\> ($w.alerts | ? {$_.AlertTemplateName -like "oss*"}).properties["p_query"]
    <Query Culture="en-US" EnableStemming="False" EnablePhonetic="False" EnableNicknames="False" IgnoreAllNoiseQuery="True" 
    SummaryLength="185" KeywordInclusion="0" QueryText="tasks" TrimDuplicates="True" Site="f5618d6c-4613-4e94-ad8f-e9c0dfae2a80"
    KeywordType="True" HiddenConstraints=" site:&quot;http://mysites.NotReally.com/sites/ghangas/Lists/Tasks&quot; " />

With this as a starting point you should be able to see what you can play with, where to build a query, and how to work with the MS Alert structure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.