PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/SPALM.SharePointSoftwareFactory/Snippets/CSharp/SharePoint Software Factory 2010/ListItems/Set the value of a lookup field of a list item.snippet

#
Unknown | 63 lines | 63 code | 0 blank | 0 comment | 0 complexity | 5b1b199d290d0c811c19d99473eb7e50 MD5 | raw file
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3. <CodeSnippet Format="1.0.0">
  4. <Header>
  5. <SnippetTypes>
  6. <SnippetType>Expansion</SnippetType>
  7. </SnippetTypes>
  8. <Title>Set the value of a lookup field of a list item</Title>
  9. <Author>Ayman El-Hattab http://ayman-elhattab.blogspot.com
  10. </Author>
  11. <Description>
  12. </Description>
  13. <HelpUrl>http://SPCodeSnippets.codeplex.com</HelpUrl>
  14. <Shortcut>
  15. </Shortcut>
  16. </Header>
  17. <Snippet>
  18. <Declarations>
  19. <Literal Editable="true">
  20. <ID>value</ID>
  21. <ToolTip>value</ToolTip>
  22. <Default>value</Default>
  23. <Function>
  24. </Function>
  25. </Literal>
  26. <Literal Editable="true">
  27. <ID>column</ID>
  28. <ToolTip>Field name</ToolTip>
  29. <Default>fieldName</Default>
  30. <Function>
  31. </Function>
  32. </Literal>
  33. <Literal Editable="true">
  34. <ID>LookupValue</ID>
  35. <ToolTip>Lookup value</ToolTip>
  36. <Default>MyLookupValue</Default>
  37. <Function>
  38. </Function>
  39. </Literal>
  40. <Object Editable="true">
  41. <ID>LookupId</ID>
  42. <ToolTip>Lookup ID</ToolTip>
  43. <Default>1</Default>
  44. <Function>
  45. </Function>
  46. <Type>int</Type>
  47. </Object>
  48. <Object Editable="true">
  49. <ID>item</ID>
  50. <ToolTip>SPListItem</ToolTip>
  51. <Default>item</Default>
  52. <Function>
  53. </Function>
  54. <Type>SPListItem</Type>
  55. </Object>
  56. </Declarations>
  57. <Code Language="csharp"><![CDATA[
  58. SPFieldLookupValue $value$ = new SPFieldLookupValue($LookupId$,"$LookupValue$");
  59. $item$["$column$"] = $value$;
  60. ]]></Code>
  61. </Snippet>
  62. </CodeSnippet>
  63. </CodeSnippets>