Access a MySite Blog from a home page webpart - sharepoint-2010

I've been away from SharePoint development for quite a while now, and I'm trying to access the information in a SharePoint 2010 blog (from one of our users, within their "MySite") from a C# webpart which will reside on the homepage of the site. The idea is to be able to highlight a certain user's latest post on the home page.
Can anyone help me to reference the blog (in dev it is located at http://myServer/my/BillsBlog) from our homepage. I've tried the following...
Reference an SPSite giving the URL as a constructor parameter, then get the correct web from there. This fails. (I'm guessing the blog is a web, rather than a site collection, but am open to being corrected there)
Get the current context from SPContext.Current, and access the AllWebs collection from there, but this doesn't inculde the /my web.
Once I find the appropriate container (SPSite or SPWeb) I can access the list to pull out the items I need, but I don't know how to get to that point. In a console App, I have it working by using the method in the first bullet abouve.
I'm really pretty much stuck now, and I simply don't know enough about what I'm looking fro to be able to search Google for answers. Any help you could give me would be greatly appreciated.

OK, my mistake. The webpart project was set up as a sandboxed one, so the approach in bullet 1 wouldn't work. Changing that switch meant it is now OK and working as per the console app.
Thanks for reading.

Related

Why would an SPO webpart on a modern page only be functional for site admins?

I have created a simple (display only) SPFx webpart that makes calls into a list on the same site as it is used. Standard users have read access over this list, site owners have Full Control. When I add the part to a page, even site owners cannot see it. Site Members (& Owners) are able to see the page (published or not), but the content which should be displayed by the webpart is missing. Note that the basic html is visible, but the data which should be retrieved is not. If I elevate a site owner to a site admin permission level, the webpart then works as intended and data is retrieved correctly and displayed. Note also that other webparts on other pages served from the same library work correctly for all groups.
Does anyone have any suggestions to explain this behaviour?
I have tried: Rebuilding and publishing webparts, new test pages created by the same and other user accounts both published and unpublished. I've carefully changed permissions on the "Site pages" library, the "ClientSideAssets" library and the site scoped app library itself.
I've answered my own question here. The error was caused by a REST query into the SPO list that contained a taxonomy (managed metadata) field. Expanding this field appeared to require the highest permission levels, thus all non admin users were unable to retrieve the data.
I later found an excellent article detailing the subject here.
I was able to trace this by serving through gulp into the online workbench, copying that URL into an incognito window for a different user account, and utilising the (Chrome) debugging tools. This tidy solution might potentially be of use to someone.

SMS gateway for Dynamics 365

First of all, I have to say that I am NET developer (C#) and my knowledge on Dynamics 365 is pretty limited. Nevertheless my employer thought that I am good enough to make that thingy from post title :)
After couple of hours researching and reading, I found this video https://www.youtube.com/watch?v=6LwZLoXS6jo which address on how to create and send SMS from Dynamics. I am aware that this require me to create new Dynamics entities, at least SMSMessage and SMSMessageTemplate, but at least I found out how to do this :)
I understood everything stated there, but as i already said, due to my lack of knowledge on Dynamics 365, I got problems with (probably) basic things regarding Dynamics.
Here are those problems:
1. As far as I can tell, in order to build SMS gateway, first thing I need to do is to add new menu item inside Dynamics 365. I presume that this new menu item should reside inside 'Contacts' menu (contacts.jpg, marked with red box) but I am not sure on how to achieve this. Please note, I do not want someone to provide me with some magic solution, I just need someone to provide me with valid links that I can use to learn about this and solve my own problem :)
2. When new menu item is in place, and user click on it, I would like to open up a form for user to select SMS template that will be used and maybe setup some other values. Same again, U do not need to help me with exact code, just with some usable links :)
3. Inside that form that user will open on menu click, I would like to know how to get list of selected contacts (from grid at contact.jpg)
When I (finally) have that list of contacts, I will create SMS entities mentioned above (video link) and everything will fall in place and (hopefully) work.
I am aware that this is probably too much to ask, cause Dynamics 365 is rather complex, and people are spending great amounts of money and their time learning to became Dynamics developers, but without help, Dynamics is making me running in circles chasing my own tail :) and getting nowhere.
Also, I will be using online Dynamics 365 so bare in mind that any solution should work with it.
if any of U think that I missed or got something wrong, please let me know.enter image description here
So basically to get you started, you should:
1) Create a solution in Settings => Customizations => Solutions
2) Add contact entity to that solution (by choosing "Add existing" under Entities pane). Don't click "Add all assets" you will need only contact metadata to get going
3) Create jScript file and add a web resource to CRM (nothing really complicated, just go to web resources in you solution and click "Add new" and specify type of your web resource as jScript and target your file).
4) Now download http://www.xrmtoolbox.com
5) For now you are interested only in plugin "Ribbon Workbench"
6) Now simply choose your solution and contact - you will see command bars for contact homepage, list and form. This is pretty strainghtforward - simply drag and drop a button wherever you like, create a command using workbench and bind the button with the command (simply choose it from a drop-down). The command you are interested in is Custom Javacript. Here you specify your web resource and name of the function that you want to call. You can also specify parameters that should be passed inside your function for example ids of selected items (if you are on the list of records).
There are many approaches to fulfil your specific needs, but being able to call a custom javascript function from a button should be a good starting point, the rest is simply the knowledge of CRM SDK, so how to create an entity using API or open a form or open a web resource - everything is very well documented and you can get it simply by asking google, so I will not post any blog here, not to advertise too much. Also I's suggest downloading latest CRM SDK (https://www.microsoft.com/en-us/download/details.aspx?id=50032) - you have many sample code there, regarding plugins and some form modifications, you should also check this out.
To make it easier for you, you should refer to this "menu" as "Command bar" or "Ribbon", so rather look for "adding custom button to command bar CRM 2016" and you will be all good. Also to make a form for choosing a template, you will probably need some custom web resource, so "creating custom html5 web resource CRM 2016" should give you some good examples.

SharePoint 2010 MySites: How can I disable the ability to create blogs in MySites?

Like the title says, I'm looking for a way to restrict user creation of blogs in MySites. I've been researching this for the past few days and can't seem to find a good option.
Presently, I'm hiding the links to create a blog through a custom Master page. I'm using feature stapling to add the custom Master page to MySites which is working; however, not really a 'best practice' since using the URL to create the blog site will still work.
I also don't want to manually change files in the SharePoint root directory structure as it is a poor practice in an upgrade path.
I would appreciate any insight...
If you're hosting MySites in a separate Web Application, you can use an Event Receiver (derived from SPWebEventReceiver and implementing WebAdding) and check that the WebTemplate is BLOG.

Search Engine Optomisation

My neighbour popped over last night to ask me for help with regards to his company's website. He said that it used to be ranked pretty high on Google but has since fallen off completely.
Now, I'm a Windows App programmer hence my request for help. I took a look and there the meta tags seem ok. I recommended that he add a <h1>heading</h1> to the pages with a page title to help reinforce the content.
I also suggested that finding related websites and getting them to link to his site was good for search ranking.
Are there any other general strategies / tools that could help?
He site is: http://www.colofinder.co.uk/
ps. BTW: this isn't just an attempt to have StackOverflow link to my neighbour's site - I'm aware that links from SO don't add to its ranking.
Go to http://ooyes.net/blog/a-step-by-step-15-minute-seo-audit-%28a-sample-from-seo-secrets%29 and read it. Then go to http://www.searchenginejournal.com/55-quick-seo-tips-even-your-mother-would-love/6760/ and read it. Then go to your friends site and look at it with that information in mind. Off the top of my head, I would add flip the company name and page title in the "title" tags. Look at the google analytics account and see how people are coming to the site. That will give you an idea of where you should start your efforts to build a workable base.
First of all he needs to be make sure that his website contents are well managed and to the point. Then Page title has to be pin point, meta tags are obsolete so try meta description. Then Main Heading should be under h1 tag, sub heading under h2 and further sub heading h3. Try to update your website one in a month.
Use community websites like Facebook, Twitter and linkidin and other related forums for posting updates about completed projects and must give inbound links. You can use your company name as an inlink to your primary website and project name as an inlink of subpage of your company website.
Keep on posting at least once in a week. Post website URL to online directories will be a great help. Do not use Blackhat SEO techniques like cloaking. Do not use any invisible text/div in your website. Make sure that whenever you give your website link any where, give the most to the point and appropriate link.
Your link should have to have that stuff against you are posting your link/sublink. Make a section on your website for tag clouds/google tags, this will be a great attraction for search engines and they will link your website to other popular websites.
Make sure these tags should be directed to top ranking website which should have relevant material. I hope this will help. Feel free if you have trouble to understand anything i have mentioned above. Best of Luck

How to setup a simple site search for a simple website?

I'm maintaining an existing website that wants a site search. I implemented the search using the YAHOO API. The problem is that the API is returning irrelevant results. For example, there is a sidebar with a list of places and if a user searches for "New York" the top results will be for pages that do not have "New York" in the main content section. I have tried adding Yahoo's class="robots-nocontent" to the sidebar however that was two weeks ago and there has been no update.
I also tried out Google's Search API but am having the same problem.
This site has mostly static content and about 50 pages total so it is very small.
How can I implement a simple search that only searches the main content portions of the page?
At the risk of sounding completely self-promoting as well as pushing yet another API on you, I wrote a blog post about implementing Bing for your site using jQuery.
The advantage in using the jQuery approach is that you can tune the results quite specifically based on filters passed to the API and playing around with the JSON (or XML / SOAP if you prefer) result Bing returns, as well as having the ability to be more selective about what data you actually have jQuery display.
The other thing you should probably be aware of is how to effectively use #rel attributes on your content (esp. links) so that search engines are aware of what the relationship is between the actual content they're crawling and the destination content it links to.
First, post a link to your website... we can probably help you more if we can see the problem.
It sound like you're doing it wrong. Google Search should work on your website, unless your content is hidden behind javascript or forms or something, or your site isn't properly interlinked. Google solved crawling static pages, so if that's what you have, it will work.
So, tell me... does your site say New York anywhere? If it does, have a look at the page and see how the word is used... maybe your site isn't as static as you think. Also, are people really going to search your site for New York? Why don't you input some search terms that are likely on your site.
Another thing to consider is if your site is really just 50 pages, is it really realistic that people will want to search it? Maybe you don't need search... maybe you just need like a commonly used link section.
The BOSS Site Search Widget is pretty slick.
I use the bookmarklet thing but set as my "home" page in my browser. So whatever site I'm on I can hit my "home" button (which I never used anyway) and it pops up that handy site search thing.