Some thoughts on programming stuff

Tag: SharePoint (Page 3 of 4)

Image Renditions throwing error in SharePoint

If you use the Image Renditions feature in SharePoint, sometimes it can throw an error when you try to open it. Usually, Image Renditions throwing error in SharePoint states that a Null Reference exception is happening. It’s a well known problem that happens since older versions of SharePoint. We can see the same problem in this post in the Technet community.  Since it may not be fixed anytime soon, I’ve wrote a simple JavaScript code. This script overwrites the custom function in the SharePoint JavaScript file that performs the modal open event.

Before diving into the problem/solution content, I must say that the Image Renditions are a nice feature for content publishers. It lets them save only one file version of an image in their SharePoint sites, but at the same time it allows the users to define the dimensions of an image and how you want to display them. The image renditions require that Blob Cache is enabled in the Web.Config to become available in the ribbon.

Image Renditions throwing error in SharePoint - Image renditions example
Image renditions example (Mastykarz)

Now returning to the problem, the bug is related to the URL being passed to the QueryString. It works fine when you try to edit an image located in the same site (SPWeb) you are editing content. The editing operation can occur when you work inside a page, a SharePoint library, a simple edit form, anything you want!

But if you edit an image rendition using an image stored in another site (SPWeb), like you are using an image from “http://sharepoint/sites/team/blog/” in a page located at “http://sharepoint/sites/team“, the error will show up because Team and Blog are different sites for SharePoint, even though they are in the same Site Collection. So SharePoint will look for an image inside Team that doesn’t exist!

Code snippet to fix error in Image Renditions

After you add this script to your Master Page, it will start working. The script will make the right calls to the ManageImageRenditions application page without problems. So the condition that causes the Image Renditions throwing error in SharePoint won’t occur anymore.

Also, if by any chance you don’t see the Image Renditions button, please check this post who might be helpful too!

References:
Technet discussion about the error
Cross-browser add event code

Get web URL from document URL in SharePoint

Maybe you need to get web URL from document URL in SharePoint, or even just grab the Site Collection URL and do some awesome logic and update some data in your site. But you are aware that it can be costy and require some array splits, substrings and those kind of tricks. So here is a code snippet to save your time to enjoy a good cup of coffee with your colleagues!

The document URL usually is composed by a site collection part, the specific web part, the Library name and then the final part containing the folders and the file name. The script basically will perform a request to a SharePoint API. Our parameter is the folder or library URL (cutting the filename) that will be made automatically. Finally, the result will come with the Web and Site Collection urls for that context.

Get web URL from document URL in SharePoint - A bunch of files in folders inside drawers (SharePoint)
A bunch of files in folders inside drawers (SharePoint) (Source: Howtogeek)
Continue reading

Optimize your SharePoint dev environment

If you optimize your SharePoint dev environment, you will be more productive. We must agree that SharePoint demands a lot of resources to run smoothly, which usually is not the case of common standalone installations used by developers to code and test.

In this post I’m going to cover some basic settings that will help on your mission to optimize your SharePoint development environment, performing better when debugging, browsing and customizing your SharePoint on-premises projects.

Continue reading

Missing Embed in SharePoint Online button in Power BI

This blog post will help you when you can’t find or it’s missing Embed in SharePoint Online button in Power BI. So you can explore the feature launched by Microsoft last year: the Power BI Web Part for SharePoint Online. It helps the users on embedding their reports in Modern Pages. The Web Part looks great and is really easy to use, requiring only the link for the report to work. For enabling it you can follow this guide for enabling the Power BI web part.

Once everything is right and you have inserted the Web Part in your page, but the button doesn’t show up, you can still do this workaround and keep testing the Web Part.

File menu without the "Embed in SharePoint Online" button
File menu without the “Embed in SharePoint Online” button
Continue reading

Default Page in Publish to web from Power BI

If you have to embed a Power BI report to a SharePoint Online Classic Page, then just go for the iFrame approach. Power BI offers a “Publish to web” feature that helps you on embedding reports easily. Although it’s not so interactive and have some limitations (can’t use Query string filtering), it still works well and offers some parameters like the possibility to set default page in Publish to web from Power BI.

We are going to cover the steps for embedding and setting a default page for our report!

Continue reading

SPFx solutions not showing in Apps in SharePoint On Premises

This post will cover a solution for a new problem related to SPFx solutions not showing in Apps in SharePoint On Premises. Before diving in the troubleshooting, let me give you some context!

In September 2017, Microsoft announced support to the SharePoint Framework in the (not so new) SharePoint 2016.  It is a great feature that will let developers explore the new framework in the cloud and on premises, allowing them to embrace the new modern era of SharePoint with SPFx apps.

Also, if you don’t know anything about the SharePoint Framework, please read this guidance to get in touch with the new trends for SharePoint Development.

The step-by-step to explore this development is pretty straightforward. Just do as the Microsoft tutorial suggests to build a web part and have an environment prepared for apps in your SharePoint 2016 farm.

Some important notes are:

  • The SharePoint Framework version must be 1.1.0 to work on SharePoint 2016;
  • SPFx extensions are in preview for this version;
  • The SharePoint Web Parts will be presented as normal Web Parts in the Ribbon;
  • There is no modern experience available yet;
  • You must use a CDN or even the Style Library to store the published files;

If everything is fine, you can just upload your App Package to your App Catalog and it will work.

But that wasn’t my case… as you may now…

Continue reading

Identify which W3WP belongs to which application

This post will help you when you want to identify which W3WP belongs to which application. It comes in handy when we need to debug Visual Web Parts and Event Receivers deployed as Farm Solutions. The basic approach requires the user to open Visual Studio, attach the W3WP processes and refresh your page to start debugging.

Well, it’s pretty common in our daily life tasks (not so much since we all should move to the Client-side of the force) to have more than one W3WP available to attach. Usually we have one for your site, other for SharePoint Web Services, another for the SharePoint Central Admin and even more for any other Application Pool process being used in your Server.

But if you want to attach to just one process and make Visual Studio more performatic and responsive, how can you do that?

Just follow the steps in this post!

Continue reading

Study Guide for Exam 70-489 – Developing Microsoft SharePoint Server 2013 Advanced Solutions

Finally I could publish the Study Guide for Exam 70-489 – Developing Microsoft SharePoint Server 2013 Advanced Solution. It’s also based on Martin Bodocky’s preparation links with some additions, like the previous post for Study Guide for Exam 70-488 – Developing Microsoft SharePoint Server 2013 Core Solutions.

Exam on Microsoft’s website: https://www.microsoft.com/en-us/learning/exam-70-489.aspx

Actually I’ve decided to publish this one because the high number of page views for the last one. At the same time Microsoft launches SharePoint 2016 and keeps improving SharePoint Online, people still are looking for the SharePoint 2013 exams.

Continue reading

Sync SharePoint files with VS Code

The last three months I’ve been working less with SharePoint and more with Angular 4/Node JS projects. This change forced me to use less Visual Studio and dive deep into Visual Studio Code in almost every task. I must say that I fell in love with the editor and decided to search about how to sync SharePoint files with VS Code.

While working with VSCode, I’ve been testing some Gulp tasks like SPSave and SPSync for automatizing file changes to SharePoint, just for fun. Because I just can’t accept SharePoint Designer anymore, my patience with it ran out.
Also the Windows feature to map a network drive to a SharePoint library isn’t good too, at least for me.
So basically the gulp tasks did the trick, but they aren’t that easy to be understood for some more “traditional” programmers in my company, which would end with few adopters here.

So while searching for SharePoint extensions just for curiosity, I found the SPGO Extension and it really impressed me!

Basically it’s an extension that with some basic setup you can start syncing files from your computer with SharePoint libraries.

SPGo Extension

SPGo Extension

Continue reading

« Older posts Newer posts »

© 2024 wiliammbr's blog

Theme by Anders NorenUp ↑