Sharepoint List Item Alerts to Item creator - sharepoint-2010

I'm trying to set up alerts to go to the item creator whenever the item is edited. Can anyone point me in the right direction.

Try to this site
http://technet.microsoft.com/en-us/library/cc288540%28v=office.12%29.aspx
http://office.microsoft.com/en-us/windows-sharepoint-services-help/create-an-alert-or-subscribe-to-an-rss-feed-HA010215103.aspx

Create an Event Receiver that handles ItemAdded. Use the following code to get the author of the item:
SPWeb web = properties.Web;
SPListItem item = properties.ListItem;
SPFieldUserValue userValue =
new SPFieldUserValue(web, item[SPBuiltInFieldId.Author].ToString());
SPUser user = userValue.User;
You can then add a new SPAlert to the user for the current item.

Related

pass a list value from one controller to another controller action in vb.net

I wanted to know how to pass a list(of string) values from one controller to another controller action. I have read that we can use TempData etc, but it is not working for me.
Initially I passed like this
Return RedirectToAction("Summary", New With {.id = id,.value = valList})
But when it redirected to the new action, the list values would be null.
Then I used the TempData funda, with the following code.
If check = 0 Then
objValues.Add("true")
objValues.Add(terminationReason)
objValues.Add(getValueStr("txtNote", fc))
TempData("objValues") = objValues
Return RedirectToAction("Summary", New With {.id = id})
End If
But after the If loop is executed, I get the option in the status bar whether to Save, open or download a file, and then the processing stops.
Any help on this front would be great.
Thanks In advance.

Enable show as conversation in outlook programatically

i am creating an Outlook add-in where i need to enable Conversation view in inbox folder("Show as Conversation") in outlook.i tried through registry Key ("Upgrade To Conversations"),but still i didn't get that.
i tried as following
RegistryKey rkconversations = Registry.CurrentUser.CreateSubKey(#"Software\Microsoft\Office" + OLVersion + #"\Outlook\Setup");
rkconversations.SetValue("UpgradeToConversations", "1", RegistryValueKind.DWord);
i aslo tried like this:
Outlook.Views views = inbox.Views;
Outlook.View view = views["Hide Reading Pane"];
if (view != null)
view.Delete();
Outlook.View view1 = views.Add("Hide Reading Pane", Outlook.OlViewType.olTableView,
Outlook.OlViewSaveOption.olViewSaveOptionThisFolderOnlyMe);
tableView = view1 as Outlook.TableView;
tableView.ShowReadingPane = false;
tableView.ShowConversationByDate = true;
tableView.ShowConversationSendersAboveSubject = true;
tableView.ShowFullConversations = true;
view1.Save();
view1.Apply();
Show as Conversations is not enabled
Try to do the required modifications in Outlook manually. Then take a look at the XML property of the View/TableView object and compare it with your own. Thus, you may find the missed point.

Checked ToolStrip Submenu Items

I'm trying to create a menu in VB.Net where one item in the menu has a submenu that sprouts off to the side when the user hovers over it. In other words, a completely ordinary submenu that everyone's used a million times.
My main menu items are of class ToolStripMenuItem. I can get close to the behavior I want by using the item's "DropDown" member. This creates the submenu behavior correctly, but I also need to be able to check and uncheck the items in the submenu. I've set the submenu items' "CheckOnClick" property to True, but checkboxes are still not displayed when I run the program.
Is it possible to get this behavior? Is it possible with ToolStripMenuItem?
Here's the code I currently have, which gets close, but doesn't give me checkboxes:
Dim mainItem As ToolStripMenuItem = New ToolStripMenuItem()
mainItem.Text = "Click For Submenu"
Dim subMenu As ToolStripDropDown = New ToolStripDropDown()
For Each item As ToolStripMenuItem In listOfItems
item.CheckOnClick = True
subMenu.Items.Add(item)
Next
mainItem.DropDown = subMenu
Try getting rid of that subMenu variable and change the code this way:
For Each mi As ToolStripMenuItem In listOfItems
mi.CheckOnClick = True
mainItem.DropDownItems.Add(mi)
Next

How to start SharePoint 2010 workflow from Infopath 2010 code behind?

I have an Infopath 2010 template with 2 buttons: submit and cancel. When the submit button is clicked I the form is saved to a document library in SharePoint 2010 and the corresponding workflow is clicked off. The user can then open the form and cancel the request by clicking on cancel. I would like to start a different workflow when cancel is clicked. Any ideas as to how that could be done?
Thanks
I have not found a method to kick off a workflow specifically from an Infopath form. I did however find a workaround; here's how I set it up:
Added a column to my list/library that will be set to true when the cancel button is selected.
In my infopath form, add my "cancel" button.
Open the control properties for the button, and select the "Rules" action. Close out of the properties dialog.
I added a fomatting rule for the cancel button so it will only display if the first workflow has started. I also disabled all other editing controls as I only wanted the cancel option to be available.
On the Control Tools contextual tab, in the Button group, click Manage Rules.
Add a new Action rule, it should run two actions: first set the value of the column we created in the first step to true; second submit data using the main data connection.
The workflow you want to run when it is cancelled should be set to run on change. As a first step, evaluate the column created above, and if true, continue the worflow. Make sure you set the value back to false so the workflow doesn't run unintentionally.
Hope that helps.
That is not a bad workaround Nostromo but we actually ended up using the out of the box SharePoint web services to start the workflow from InfoPath code behind. Here is the method we developed to do that.
public static void StartWorkflow(string siteUrl, string docUrl,string workflowName, List<string> approvers,string description)
{
var workflow = new Workflow();
workflow.Url = siteUrl+ "/_vti_bin/workflow.asmx";
workflow.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlNode assocNode = workflow.GetTemplatesForItem(docUrl);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(assocNode.OwnerDocument.NameTable);
nsmgr.AddNamespace("wf", "http://schemas.microsoft.com/sharepoint/soap/workflow/");
XmlDocument doc = new XmlDocument();
Guid templateID = new Guid();
bool workflowFound = false;
XPathNodeIterator rows = assocNode.CreateNavigator().Select("//wf:WorkflowTemplate", nsmgr);
while (rows.MoveNext())
{
if (rows.Current.GetAttribute("Name", "").ToLower() == workflowName.ToLower())
{
doc.LoadXml(rows.Current.SelectSingleNode("wf:AssociationData/wf:string", nsmgr).Value);
XPathNavigator idNode = rows.Current.SelectSingleNode("wf:WorkflowTemplateIdSet", nsmgr);
templateID = new Guid(idNode.GetAttribute("TemplateId", ""));
workflowFound = true;
break;
}
}
if(!workflowFound)
throw new Exception("System couldn't location the workflow with name: " +workflowName);
XmlElement xmlRoot = doc.DocumentElement;
nsmgr = new XmlNamespaceManager(assocNode.OwnerDocument.NameTable);
nsmgr.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD");
xmlRoot.SelectSingleNode("/my:myFields/my:Description", nsmgr).InnerText = description;
XmlNode reviewersNode = xmlRoot.SelectSingleNode("/my:myFields/my:Reviewers", nsmgr);
reviewersNode.InnerXml = "";
foreach (var user in approvers)
{
XmlNode personNode = reviewersNode.AppendChild(doc.CreateElement("my:Person"));
XmlNode accountIdNode = personNode.AppendChild(doc.CreateElement("my:AccountId"));
accountIdNode.InnerText = user;
XmlNode accountTypeNode = accountIdNode.AppendChild(doc.CreateElement("my:AccountType"));
accountTypeNode.InnerText = "User";
}
XmlNode workflowNode = workflow.StartWorkflow(docUrl, templateID, doc.DocumentElement);
}

VSTO - Outlook 2007 - Display form before send message?

I'm new to Outlook add-in programming and not sure if this is possible:
I want to display a pop-up form (or selection) and ask for user input at the time they click Send. Basically, whenever they send out an email (New or Reply), they will be asked to select a value in a dropdown box (list items from a SQL database, preferrably).
Base on their selection, a text message will be appended to the mail's subject.
I did my research and it looks like I should use Form Regions but I'm not sure how can I display a popup/extra form when user click Send.
Also, it looks like Form Regions can be used to extend/replace current VIEW mail form but can I use it for CREATE NEW form?
Thanks for everybody's time.
You can probably add the Item Send event handler in the ThisAddIn Internal Startup method and then in the Item Send Event, call the custom form (a windows form).
In the below sample I call a custom windows form as modal dialog before the email item is send and after the send button is clicked.
private void InternalStartup()
{
this.Application.ItemSend += new ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
}
void Application_ItemSend(object Item, ref bool Cancel)
{
if (Item is Microsoft.Office.Interop.Outlook.MailItem)
{
Microsoft.Office.Interop.Outlook.MailItem currentItem = Item as Microsoft.Office.Interop.Outlook.MailItem;
Cancel = true;
Forms frmProject = new ProjectForm();;
DialogResult dlgResult = frmProject.ShowDialog();
if (dlgResult == DialogResult.OK)
System.Windows.Forms.SendKeys.Send("%S"); //If dialog result is OK, save and send the email item
else
Cancel = false;
currentItem.Save();
currentItem = null;
}
}