Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
SharePoint 2010: Dispaly a Users Profile Picture in a Content Query Web Part Using SPDesigner Workflow - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2014-12-09

In short, the project was to display Blog Posts on our Intranet home page in a web part. No, doubt the CQWP comes to mind first. It is easy enough to configure by selecting your query source, and styling how it will be presented in the web part via web part editor and xslt (another blog). But there was one requirement that wasn’t so easy to figure out; How do I get the submitters Profile Picture to display in the web part alongside their post submission. I searched high and low only to find very little on the subject, here is one suggestion on completing the task. (http://www.glynblogs.com/2010/11/display-a-users-picture-in-the-content-query-web-part.html). So, a community member here (JC) mentioned it may be possible to achieve this with SPDesigner workflow. He passed on some suggestions which I was able to simplify and come up with a very easy way to accomplish my task (thanks for helping me think JC). So here are the steps to follow.

1. Create a list column named Author Picture (you can use any name you like) on the list that will be used in the web part. The ‘type’ should be ‘hyperlink or picture’

 

2. Now open SPDesigner and create a new ‘List’ workflow. Name it what you wish (ex. addUserProfilePic)

3. Create a workflow variable named ‘PicPath’

4. Now we add an ‘Action’, setting the local variable ‘PicPath’ to %User Profiles:Picture%.

5. Then we set our column ‘Author Picture’ to or PicPath variable.

 

6. Don’t forget to set your Start Options for the workflow. Then Save and Publish your workflow to the list

Now, I went ahead and hid the ‘Author Picture’ column from the list and on the NewPost and EditPost aspx pages. No need for the user to see themselves here. Now when a user post a blog and it is approved, it will appear in the CQWP just like the below… Formatting the rest of the web part was done via xsl. Thanks to all who gave me good insight on the way..

Example:

Hope this will help someone in the future.  

(Visited 161 times, 1 visits today)

About the author 

Jason Smallwood

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.