Hard learned SharePoint development tips

1,397 views
1,094 views

Published on

SharePoint development is a pain. You need a big VM, lots of RAM, can’t use any of the new fun stuff they show you at TechED. The API can be cumbersome, documentation can be as trustworthy as your average Russian banker.

How is a SharePoint developer to be productive and write reliable code in such a hostile environment? This hard learned session is both funny and sad at the same time where Sahil describes some of his painfully learnt development lessons.

Sahil Malik

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,397
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
32
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Hard learned SharePoint development tips

  1. 1. Hard learned SharePoint dev tips SAHIL MALIK WWW.WINSMARTS.COM @SAHILMALIK SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013
  2. 2. sponsors
  3. 3. C:>whoami 11xMVP 15xAuthor Pluralsight Author Microsoft Metro Trainer Funny and Honest HTTP://BLAH.WINSMARTS.COM @SAHILMALIK
  4. 4. Hard learned SharePoint dev tips 0945AM Hard learned CSOM and REST 0345PM
  5. 5. Lists and Document Libraries
  6. 6. Lists live in SPWebs
  7. 7. dbo.AllLists
  8. 8. Primary Key for AllLists
  9. 9. Content Types – will make performance worse
  10. 10. tp_Fields
  11. 11. dbo.AllUserData
  12. 12. My Test List
  13. 13. Example
  14. 14. Example 2
  15. 15. tp_ColumnSet
  16. 16. Sparse Columns
  17. 17. AllUserData tp_ID identify the list item tp_GUID To uniquely identify the list item tp_ListId To identify which list the item belongs to. tp_SiteId To identify which site the item belongs to. It is the value of ‘Id’ in ‘AllSites’ table tp_RowOrdinal Zero based ordinal index in the set of rows representing the list item tp_Author User who created the list item tp_Editor User who last edited the list item tp_Modified Modified date tp_Created Created date tp_DeleteTransactionID Not 0x if the item is in recycle bin tp_IsCurrentVersion (bit) 1 or 0, identifying latest version nvarchar1..64 Stores values of application fields of type nvarchar ntext1..32 Stores application fields of type ntext bit1..16 Application fields of type bit datetime1..8 Application fields of type datetime
  18. 18. AllUserData float 1..12 Application fields of type float Int1..16 Application fields of type int sql_variant1..8 Application fields of type sql_variant
  19. 19. AllUserData - takeaways
  20. 20. Now lets talk documents!
  21. 21. Test Data
  22. 22. How are documents stored?
  23. 23. Document Storage
  24. 24. DocStreams
  25. 25. Scientifically accurate picture of RBS
  26. 26. Document Storage – Lessons Learnt
  27. 27. Careful of iterators! Avoids multiple calls to DB Does not create SPListItemCollection over and over again
  28. 28. Number of Items in a list
  29. 29. SPQuery is your friend 2147483648 And its getting every single column!
  30. 30. Avoid reloading objects
  31. 31. SharePoint objects are not threadsafe!
  32. 32. Getting a list proc_EnumLists proc_MapUrlToListAndView proc_EnumLists loads all information of all lists in the SPWeb object, and then does a .Title comparison to find the list you need. proc_MapUrlToListAndView finds the GUID for the associated list, and then loads the metadata for the list you need.
  33. 33. Deleting Items
  34. 34. Good vs Evil Evil Good SPList.Items.Count SPList.ItemsCount SPList.Items[Guid] SPList.GetItemByUniqueId(Guid) SPList.Items[Int32] SPList.GetItemById(Int32) SPList.Items.GetItemById(Int32) SPList.GetItemById(Int32 SPList.Items.NumberOfFields SPQuery + ViewFields SPList.Items.ReorderItems Use SPQuery.ListItemCollectionPosition to do paging SPFolder.Files.Count SPFolder.ItemCount
  35. 35. .Dispose
  36. 36. .Dispose
  37. 37. questions? HTTP://BLAH.WINSMARTS.COM @SAHILMALIK
  38. 38. thank you. SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013

×