SharePoint Boss

Benvenuti nel mio blog
posts - 13, comments - 589, trackbacks - 3

Social Comments e Security Trimming

Eccomi qui a scrivere un bel post sui Commenti di SharePoint, che mi ha fatto tribolare per un pò ma che alla fine sono riuscito a svangarla (direi come al solito :P).

In un ambiente enterprise dove la security trimming è attivata potremmo avere qualche difficoltà con alcuni oggetti "social" di SharePoint, in particolare io mi sono scontrato con il metodo GetComments dell'oggetto SocialCommentManager, perchè? Perchè avevo la necessità di far visualizzare a livello pubblico i commenti inseriti su una determinata Uri dagli utenti della intranet che sto sviluppando. Il risultato era che sul mio ambiente di sviluppo, come al solito, tutto fila liscio, mentre una volta fatto il deploy dal cliente...succedeva che ogni utente vedeva i propri commenti :( azz!

Il seguente snippet riporta il modo con cui richiamavo il metodo GetComments:

SPWeb web = SPContext.Current.Web;

SPServiceContext context = SPServiceContext.Current;

Uri uri = new Uri(web.Url + pageUrl);

SocialCommentManager cm = new SocialCommentManager(context);

SocialComment[] commenti = cm.GetComments(uri);

Ma non finisce qui, dopo che ho certificato che il codice era giusto ma il risultato atteso non era esatto, provo con il web service di SharePoint e quindi altro snippet:

SocialDataService sds = new SocialDataService();

Microsoft.Office.Server.SocialData.SocialDataService.SocialCommentDetail[] comments = sds.GetCommentsOnUrl(string.Concat(SPContext.Current.Site.Url, pageUrl), null, null, null);

Niente, sempre lo stesso risultato :(

Bene, disassembliamo e vediamo che cosa fanno i metodi e faccio una scoperta che mi lascia stupefatto. C'è un bel metodo INTERNAL ..... GetComments che accetta un parametro bool needSecurityTrim e ora?

Sia lodata la Reflection, con l'ultimo snippet potrete avere la soluzione ai vostri problemi, senza dover ricorrere a disabilitare il Security Trimming via PowerShell:

var type = typeof(SocialCommentManager);

var methods = type.GetMethods(System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

var method = methods.FirstOrDefault(m => m.ToString() == "Microsoft.Office.Server.SocialData.SocialComment[] GetComments(System.Uri, Int32, Int32, System.DateTime, Boolean)");

if (method == null) throw new MissingMethodException("Social GetComment method not found.");

var comments = method.Invoke(cm, new object[] { uri, 10000, 0, DateTime.MinValue, false }) as SocialComment[];

Print | posted on mercoledì 8 febbraio 2012 00:24 | Filed Under [ SharePoint 2010 .NET Framework 3.5 ]

Feedback

Gravatar

# re: Social Comments e Security Trimming

he romance Cocktail Dresses surrounding gentle shades, their presence at weddings dresses grew from wedding dresses 2012 a practical reason. Considering the fact that dark colours absorb much more warmth, pastel lace wedding dresses shades had been extra secure for summer sea
31/05/2012 06:13 | andla
Gravatar

# re: Social Comments e Security Trimming

Thanks for taking this opportunity to discuss this, I appreciate with this and if you have some more information please share it with me.
09/08/2013 18:44 | paper editing
Gravatar

# re: Social Comments e Security Trimming

Thanks for this awesome webpage. I like it..
Jaguar XJ Within The High Finish Luxury Saloon Section
Vehicle Automation in 2030 With $100 Billion
LG Watch Urbane, a premium Watch that Falls Wanting Greatness
20/05/2015 09:17 | muha
Gravatar

# re: Social Comments e Security Trimming

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks

paket umroh murah 2016
07/01/2016 11:15 | umroh haji murah
Gravatar

# re: Social Comments e Security Trimming

Jalan-jalan ke gunung bromo mengunjungi 4 titik lokasi wisata dengan keindahan panoramanya yang sungguh fenomenal dan terkenal ke seantero jagat raya. Silahkan pesan paket wisata bromo tour midnight harga murah paket wisata bromo dari malang harga murah sewa mobil malang di tempat kami harus dengan driver dan tidak bisa lepas kunci dengan rincian harga mobil sopir 375.000, mobil sopir bbm 475.000 dan paket all include 525.000. Info lengkap jasa sewa mobil di malang dengan sopir lihat info lengkap disini armada rental mobil di surabaya yang disediakan semua tergolong keluaran terbaru dan juga terawat dengan baik secara berkala. Pelayanan ini memang mengedepankan kepuasan pelanggan setia rental mobil surabaya dan jika anda butuh sewa mobil di surabaya yang murah klik penawaran lengkap disini sewa mobil avanza di jogja yang bisa memuat hingga 8 orang beserta sopir bisa anda gunakan bersama rombongan untuk mengunjungi tempat-tempat wisata populer di jogja baca. Silahkan booking sewa mobil avanza di jogja sewa mobil jogja terpercaya rental mobil harga murah di bali yang bisa antar jemput ke bandara ngurah rai di denpasar bali dan juga bisa digunakan untuk keliling ke objek-objek wisata di pulau dewata bali. Jasa antar jemput ini sudah termasuk dalam sewa mobil di bali rental mobil bali murah terpercaya
17/10/2016 10:34 | rental mobil murah surabaya
Gravatar

# re: Social Comments e Security Trimming

jika anda ingin berlibur di kota surabaya dan anda berasal dari luar kota seperti jakarta maka saat berada di surabaya sebaiknya menggunakan layanan transportasi sewa mobil surabaya untuk liburan atau rekreasi lihat tautan berikut jasa sewa mobil di rental mobil bali sangatlah banyak sewa mobil harga murah di bali cara memilih kantor rental mobil di malang yang aman dan terpercaya baca info berikut jasa paket wisata bromo tour dengan menggunakan sewa mobil elf pariwisata yang bisa memuat orang hingga 18 orang lihat info berikut jasa sewa mobil malang yang terpercaya baca lengkapnya disini battlejuice halloween custume female battlejuice halloween custume female
17/10/2016 17:56 | rental mobil elf di malang
Gravatar

# re: Social Comments e Security Trimming

Railing Balkon

Railing Balkon

Pagar Besi
29/08/2017 12:47 | venus
Gravatar

# re: Social Comments e Security Trimming

This is only the data I am discovering all over the place. I simply subscribe your online journal. This is a decent blog.. huge pitbulls
23/12/2017 03:25 | kite
Gravatar

# re: Social Comments e Security Trimming

مجموعه آرمانیک طراحی سایت
https://armanic.com

مجموعه مدیر وب آموزش بازاریابی
https://modireweb.com

اگر تمایل به خواندن مقاله ای در زمینه بازاریابی ویروسی دارید روی لینک زیر کلیک کنید
https://modireweb.com/viral-marketing

آیا میدانید بیت کوین چیست خب بر روی لینک زیر کلیک نید تا بیشتر بدانید
https://modireweb.com/Bitcoin

آیا تا به حال با بازاریابی عصبی آشنا شدید خب پس روی لینک زیر کلیک کنید
modireweb.com

آیا با اصطلاح اینفلوئنسر مارکتینگ آشنا هستید اگر علاقه مند به این مضوع می باشد روی لینک زیر کلیک کنید
https://modireweb.com/influencer-marketing

آیا چیزی در مورد ایمیل مارکتینگ میدانید روی لینک زیر کلیک کنید
modireweb.com

برای اطلاعات بیشتر در مورد صفحه فرود روی لینک زیر کلیک کنید
https://modireweb.com/what-is-a-Landing-page

آیا علاقه مند به بازاریابی در شبکه های اجتماعی هستید
modireweb.com/How-does-SMM-reach-our-target

بیشتر در مورد نقسه سایت بدانید
https://modireweb.com/What-is-a-site-map

در این مقاله زیر ما در مورد برند سازی صحبت خواهیم کرد
modireweb.com

در این مقاله ما در مورد بازاریابی محتوا صحبت می کنیم
modireweb.com/5-big-mistakes-in-content-marketing
F
در این مقاله ما در مورد پیج رنک گوگل صحبت می کنیم
https://modireweb.com/Why-Google-PageRank-of-zero

در این مقاله ما در مورد تجارت الکترونیک صحبت خواهیم کرد
modireweb.com/How-to-succeed-in-B2B-ecommerce-

در این مقاله ما در مورد گوگل پلاس صحبت خواهیم کرد
modireweb.com/Could-Google-Be-the-Future-of-SEO

در این مقاله ما در مورد الگوریتم های گوگل صحبت خواهیم کرد
https://modireweb.com/seo-and-google-algorithm

در این ویدئو ما در مورد گرفتن نماد اعتماد صحبت خواهیم کرد
https://modireweb.com/enamad-learning
30/01/2018 11:11 | Modireweb
Gravatar

# re: Social Comments e Security Trimming

Its an incredible joy perusing your post.Its brimming with data I am searching for and I want to post a remark that "The substance of your post is marvelous" Great work. detective agency in hyderabad
01/03/2018 01:41 | iwefji
Gravatar

# re: Social Comments e Security Trimming

It was a decent post to be sure. I completely delighted in understanding it in my lunch time. Will definitely come and visit this blog all the more frequently. Much obliged for sharing. non invasive lipo
14/03/2018 02:44 | iwefji
Gravatar

# re: Social Comments e Security Trimming

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.  can dogs eat wheat pasta
21/03/2018 16:30 | iwefji
Gravatar

# re: Social Comments e Security Trimming

I truly value this superb post that you have accommodated us. I guarantee this would be helpful for a large portion of the general population. 2018 lexus nx
22/03/2018 17:49 | iwefji
Gravatar

# re: Social Comments e Security Trimming

kareonline
kasbokarepro
kasbokarsite
javid-garshasbi
gonzaga.edu
unina.it
uclouvain
revistas
javid_garshasbi
umich , tiba
javid ,
Hamyareweb ,
C6LLW6X ,
internet-business ,
rhizome ,
marketings ,
vox ,
takblog ,
sitearia ,
marketing ,
e-marketing ,
blogsazan ,
marketingland ,
hamyar ,
kareinterneti ,
marketingeirani ,
04/04/2018 10:19 | Javid Garshasbi
Gravatar

# kamagra store in ny nam

kamagra 100mg chewable tablets india
[url=http://lkkkopzql.com/]kamagra usa[/url]
kamagra 100mg tablets usa 247 pills
kamagra 100mg tablets for sale uk
kamagra forum hr
24/04/2018 20:49 | MichaelDut
Gravatar

# kamagra oral jelly uses nam

kamagra forum srpski
[url=http://lkkkoqaql.com/]kamagra 100 mg oral jelly[/url]
kamagra 100mg tablets australia
buy kamagra 100mg
kamagra gold 100mg rendeles
25/04/2018 01:21 | Philipboago
Gravatar

# kamagra store nam

kamagra 100 gold
[url=http://lkkkspwql.com/]kamagra 100 mg oral jelly[/url]
india kamagra 100mg chewable tablets
kamagra 100 mg
kamagra 100 oral jelly review
25/04/2018 03:22 | KennyLedge
Gravatar

# kamagra oral jelly for sale in usa nam

kamagra 100mg chewable lifesavers
[url=http://lkbkspwql.com/]kamagra 100mg[/url]
kamagra 100mg oral jelly how to use
kamagra oral jelly ohne wirkung
kamagra forum 2014
25/04/2018 12:14 | Jamespaure
Gravatar

# kamagra 100 sildenafil citrate chewable tablets 100 mg sen

kamagra oral jelly in australia
[url=http://kamagraonl.com/]buy kamagra 100 mg oral jelly[/url]
kamagra oral jelly 100mg
kamagra 100mg
kamagra oral jelly usa
http://kamagraonl.com/
kamagra oral jelly kaufen forum
10/05/2018 19:40 | Marionurive
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET