Tag Archives: SharePoint Short

Client Context in AddIn

How to get the client context for code in a provider-hosted add-in that is called outside of the SharePoint context. For example, you want a page in your solution to be called directly and not from SharePoint. Reasons for this … Continue reading

Posted in SharePoint, SharePoint Shorts | Tagged | Leave a comment

Run With Elevated Privilges

SharePoint Short #20 Instead of explicitly wrapping code in a RunWithElevatedPrivileges block, it’s better to first check if the user has sufficient privileges and only elevate when they don’t. Instead of: SPSecurity.RunWithElevatedPrivileges(() => { // elevated code… });SPSecurity.RunWithElevatedPrivileges(() => { … Continue reading

Posted in SharePoint, SharePoint Shorts | Tagged | Leave a comment

Custom_AddDocLibMenuItems

SharePoint Short #19 When implementing your own Custom_AddDocLibMenuItems, which allows you to add custom menu items to the ECB of SharePoint items, remember to check for other implementations of this method before your own version. For example: function YourImplementationOf_AddDocLibMenuItems(m, ctx, … Continue reading

Posted in SharePoint, SharePoint Shorts | Tagged , | 4 Comments

Loopback Check and 401.1 Error

SharePoint Short #18 If you’re developing a web service for SharePoint, or trying to access one of the SharePoint web services, through server code and get a 401.1 Unauthorized exception, it’s worth checking if the status of the loopback check, … Continue reading

Posted in Configuration, SharePoint Shorts | Tagged | 1 Comment

Create Zip File

SharePoint Short #17 Not so much a SharePoint post, but can be used in a SharePoint project, so counts for me 🙂 Using the WindowsBase assembly provides access to the System.IO.Packaging namespace and the PackagePart class. Using this class to … Continue reading

Posted in SharePoint Shorts | Tagged | Leave a comment