Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • VICTORIA VILASINY 12 posts 82 karma points
    Feb 13, 2019 @ 11:53
    VICTORIA VILASINY
    0

    Instagram propertyvalue always null

    Hello Team, Our requirement is to show the latest images from our instagram account here are the steps i followed

    1. Installed the package Skybrud.Social.Umbraco
    2. Created a Datatype whose property editor is Skybrud.Social-Instagram OAuth, and added our clientId, clientsecret and Urk and also selected the scopes
    3. Under Document Types, Added this as property for root content
    4. Added this instagram Property in content homepage layout.

    5 . Added a instagram.cshtml under Partial Views in settings and following is the sample code that i have used in this cshtml

    @{

    // Get the OAuth information stored in the property
        var currentContent = Umbraco.TypedContent(UmbracoContext.PageId.Value);
        var rootNode = currentContent.AncestorOrSelf(1);
        var instagram = rootNode.GetPropertyValue<InstagramOAuthData>("instagram");
    
        <p>hello1</p>
            // Check whether the OAuth data is valid
           if (instagram != null) {
          <p>hello2</p>
           }
    

    } 6. added @Html.Partial("instagram") in the page where i want instagram to be shown

    Result : hello2 is never displayed which means instagram property is null always

    Please help me fix this issue as this is one of the important requirements from our client

    Thankyou

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Feb 13, 2019 @ 12:33
    Dan Diplo
    0

    Not sure whether it will help, but you can simplify getting the root node:

    var rootNode = Umbraco.AssignedContentItem.Site();
    var instagram = rootNode.GetPropertyValue<InstagramOAuthData>("instagram");
    

    Have you double-checked your property is called instagram and not something else?

  • VICTORIA VILASINY 12 posts 82 karma points
    Feb 13, 2019 @ 13:08
    VICTORIA VILASINY
    0

    Hello Dan, I tried the code which you sent . Still i have the same issue

    Yes the property is called as "instagram".

    Note : I think there is no problem in getting root as i was able to display all children under this root.

Please Sign in or register to post replies

Write your reply to:

Draft