Is the New Google Calendar API provide any method so that I can search any user public calendar using his/her email Address.
The answer is available in one of google calendar's docs here- http://code.google.com/apis/calendar/data/1.0/developers_guide_js.html
var myService;
var feedUrl = "https://www.google.com/calendar/feeds/liz#gmail.com/public/full";
function setupMyService() {
myService = new google.gdata.calendar.CalendarService('exampleCo-exampleApp-1');
}
function getMyFeed() {
setupMyService();
myService.getEventsFeed(feedUrl, handleMyFeed, handleError);
}
Also, there are some threads which discuss the same issue of fetching feeds from public calendars.
1) http://www.google.com/support/forum/p/apps-apis/thread?tid=5f8c3bf4b9836bd1&hl=en
2) http://www.google.com/support/forum/p/apps-apis/thread?tid=2e8b8003b1aa5fd9&hl=en
Related
Please how can I get the receipt number on Stripe with c#
My image :
https://www.casimages.com/i/191231053006538388.png.html
Maybe with a Session ID ?
You'd access the Charge object and it's a field on that resource.
You say you're using Checkout. So the Charge is under session.payment_intent.charges.data[0]. It requires a little digging to get it but it's all there. I'd suggest that when you receive the event as part of fulfilling the order etc, retrieve the Session(stripe.com/docs/api/checkout/sessions/retrieve) and expand "payment_intent". Then session.PaymentIntent.Charges.Data[0].ReceiptNumber is the value you're looking for.
static void CheckoutSessionReceiptEmail()
{
var service = new Stripe.Checkout.SessionService();
var session = service.Get(
"cs_test_nHUZtpUvaI80YAKGgCMGyeHfjQ6nMtUhVLeVpowWsgpfyGujccGxnAuJ",
new Stripe.Checkout.SessionGetOptions
{
Expand = new List<string> { "payment_intent" }
}
);
Console.WriteLine(session.PaymentIntent.Charges.Data[0].ReceiptNumber);
}
Is there a way you can have a list of users who have full control to a web.
There is a function called owner which gives the owner of current site collection but is there anything similar for a sub site or web.
I use a function that gives you all the permission for the user when you provide a username and web URL
function getUserRoles(webUrl,accountName)
{
return getUserEffectivePermissions(webUrl,accountName).then(function(data){
var permissions = new SP.BasePermissions();
permissions.initPropertiesFromJson(data);
var permLevels = [];
for(var permLevelName in SP.PermissionKind.prototype) {
if (SP.PermissionKind.hasOwnProperty(permLevelName)) {
var permLevel = SP.PermissionKind.parse(permLevelName);
if(permissions.has(permLevel)){
permLevels.push(permLevelName);
}
}
}
return permLevels;
});
}
use this rest api to get all users and filter the login name
_api/web/siteusers
to get the subsite use this
/_api/web/webinfos
Graph API Paging explains that the response would contain a field #odata.nextLink which would contain a skiptoken pointing to the next page of contents.
When I test the API, I'm getting a fully-qualified MS Graph URL which contains the skiptoken as a query param. E.g. Below is the value I got for the field #odata.nextLink in the response JSON.
https://graph.microsoft.com/v1.0/users?$top=25&$skiptoken=X%27445370740200001E3A757365723134406F33363561702E6F6E6D6963726F736F66742E636F6D29557365725F31363064343831382D343162382D343961372D383063642D653136636561303437343437001E3A7573657235407368616C696E692D746573742E31626F74322E696E666F29557365725F62666639356437612D333764632D343266652D386335632D373639616534303233396166B900000000000000000000%27
Is it safe to assume we'll always get the full URL and not just the skiptoken? Because if it's true, it helps avoid parsing the skiptoken and then concatenating it to the existing URL to form the full URL ourselves.
EDIT - Compared to MS Graph API, response obtained from Azure AD Graph API differs in that the JSON field #odata.nextLink contains only the skipToken and not the fully-qualified URL.
if you would like to have all users in single list, you can achieve that using the code that follows:
public static async Task<IEnumerable<User>> GetUsersAsync()
{
var graphClient = GetAuthenticatedClient();
List<User> allUsers = new List<User>();
var users = await graphClient.Users.Request().Top(998)
.Select("displayName,mail,givenName,surname,id")
.GetAsync();
while (users.Count > 0)
{
allUsers.AddRange(users);
if (users.NextPageRequest != null)
{
users = await users.NextPageRequest
.GetAsync();
}
else
{
break;
}
}
return allUsers;
}
I am using graph client library
Yes. In Microsoft Graph you can assume that you'll always get the fully qualified URL for the #odata.nextLink. You can simply use the next link to get the next page of results, and clients should treat the nextLink as opaque (which is described in both OData v4 and in the Microsoft REST API guidelines here: https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#98-pagination.
This is different from AAD Graph API (which is not OData v4), which doesn't return the fully qualified next link, and means you need to do some more complicated manipulations to get the next page of results.
Hence Microsoft Graph should make this simpler for you.
Hope this helps,
The above code did not work for me without adding a call to 'CurrentPage' on the last line.
Sample taken from here.
var driveItems = new List<DriveItem>();
var driveItemsPage = await graphClient.Me.Drive.Root.Children.Request().GetAsync();
driveItems.AddRange(driveItemsPage.CurrentPage);
while (driveItemsPage.NextPageRequest != null)
{
driveItemsPage = await driveItemsPage.NextPageRequest.GetAsync();
driveItems.AddRange(driveItemsPage.CurrentPage);
}
I followed Tracy's answer and I was able to fetch all the messages at one go.
public List<Message> GetMessages()
{
var messages = new List<Message>();
var pages = Client.Users[_email]
.Messages
.Request(QueryOptions)
// Fetch the emails with attachments directly instead of downloading them later.
.Expand("attachments")
.GetAsync()
.Result;
messages.AddRange(pages.CurrentPage);
while (pages.NextPageRequest != null)
{
pages = pages.NextPageRequest.GetAsync().Result;
messages.AddRange(pages.CurrentPage);
}
return messages;
}
I am trying to find a guide or something that can teach me to make a view that users navigate to when they login. The view should show profile properties like firstname,lastname, and additional custom data. The problem is I dont know how to send the id from login to a another view. In other words when this succeeds in AccountController...
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
// return RedirectToAction("Customer", "Account");
... I want to send id to another view. I tried make a view like so:
public ActionResult Customer(string userId)
{
ApplicationDbContext _context = new ApplicationDbContext();
var UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_context));
var ThisUser = UserManager.FindById(User.Identity.GetUserId());
//string a = Convert.ToString(User.Identity.GetUserId());
//RegisterViewModel RVM = db.RegisterViewModels.Find(a);
return View(ThisUser);
}
It did not work. Any suggestions?
There is a lot of information to found about ASP.NET Identity on the web, in particular Microsoft's own documentation is really good. Check this out for a starter for some great examples.
In CRM 2011 it's easy to get current user language using javascript, using the following code:
Xrm.Page.context.getUserLcid();
Is there anyway to do the same in server side using plugins ?
Thanks and best regards
Here is a sample in a Plugin:
class GetUserLanguage : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
//PluginSetup abstracts setup code: http://nicknow.net/dynamics-crm-2011-abstracting-plugin-setup/
var p = new PluginSetup(serviceProvider);
var user = p.Context.InitiatingUserId;
var lcid = RetrieveUserUiLanguageCode(p.Service, user);
}
//From the SDK: http://msdn.microsoft.com/en-us/library/hh670609.aspx
private static int RetrieveUserUiLanguageCode(IOrganizationService service, Guid userId)
{
var userSettingsQuery = new QueryExpression("usersettings");
userSettingsQuery.ColumnSet.AddColumns("uilanguageid", "systemuserid");
userSettingsQuery.Criteria.AddCondition("systemuserid", ConditionOperator.Equal, userId);
var userSettings = service.RetrieveMultiple(userSettingsQuery);
if (userSettings.Entities.Count > 0)
{
return (int)userSettings.Entities[0]["uilanguageid"];
}
return 0;
}
}
There are a couple options for it that I've used before.
Use a Retrieve on the systemuser entity using the userid from the plugin execution context. Don't forget to set the column set to just get the user! Otherwise systemuser can be a hefty retrieve for online envs.
Issue a WhoAmI request to the server.
I personally use the former because Retrieves are very common for devs who use plugins, but not all are familiar with the WhoAmI message (it derives from retrieve: http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.whoamirequest.aspx)
Unfortunately I have not found a way to get it without issuing a request to the server. Let me know if this helps!
Nick
I think that once the user selects a preferred locale you can pick it up using:
Thread.CurrentUICulture.LCID