Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Code for creating alerts: User's Alerts always null

I would then go check out:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spalert_members.aspx

and

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spalerttemplate_members.aspx

and

http://msdn.microsoft.com/en-us/library/bb897791.aspx

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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